home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / coloredbooks / GreyBook.sit.hqx / Grey Book
Text File  |  1997-11-17  |  146KB  |  4,311 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. RATIONALE FOR SELECTING ACCESS CONTROL LIST FEATURES FOR THE UNIX SYSTEM
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15. TRUSTED UNIX WORKING GROUP
  16. (TRUSIX) RATIONALE FOR SELECTING ACCESS CONTROL LIST FEATURES
  17. FOR THE UNIX SYSTEM
  18.  
  19.  
  20.  
  21. NCSC-TG020-A
  22.  
  23.  
  24. Library No. 5-232,508
  25. FOREWORD
  26.  
  27.  
  28.  
  29. The  National  Computer  Security  Center  (NCSC) formed  the
  30. Trusted  UNIX Working Group (TRUSIX) in 1987 to provide technical
  31. guidance to vendors and evaluators involved in the development
  32. of Trusted Computer System Evaluation Criteria (TCSEC) class B3
  33. trusted UNIX* systems. The NCSC specifically targeted the UNIX
  34. operating system for this guidance because of its growing popularity
  35. among the government and vendor communities.  By addressing the
  36. class B3 issues, the NCSC believes that this information will
  37. also help vendors understand how evaluation interpretations will
  38. be made at the levels of trust below this class.  TRUSIX is making
  39. no attempt to address the entire spectrum of technical problems
  40. associated with the development of division B systems; rather,
  41. the intent is to provide examples of implementations of those
  42. security features discernible at the user interface that will
  43. be acceptable at this level of trust.
  44.  
  45.  
  46. TRUSIX is not intended to be a standards body. nor does it intend
  47. to produce a de facto standard to compete against POSIX. Additionally,
  48. the TRUSIX documents are not to be construed as supplementary
  49. requirements to the TCSEC. The TCSEC is the only metric against
  50. which the trustworthiness of an operating system will be evaluated.
  51.  
  52.  
  53. This document, "Rationale for Selecting Access Control List
  54. (ACL) Features for the UNIX System," is the first in a series
  55. of companion documents being produced by TRUSIX. The guidelines
  56. described in this document provide alternative methods for implementing
  57. ACLs in the UNIX system.
  58.  
  59.  
  60. UNIX is a registered trademark of AT&T
  61.  
  62.  
  63. Recommendations for revision to this guideline are encouraged
  64. and will be reviewed periodically by the NCSC. Address all proposals
  65. for revision through appropriate channels to:
  66.  
  67.  • National Computer Security Center
  68.  • 9800 Savage Road
  69.  • Fort George G. Meade. MD 20755-6000
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. Attention: Chief, Technical Guidelines Division
  78.  
  79.  
  80. 18 August 1989
  81.  
  82.  • Patrick R.    GALLAGHER  JR
  83.  • Director
  84.  • National Computer Security Center
  85.  
  86.  
  87. ACKNOWLEDGMENTS
  88.  
  89.  
  90.  
  91. Special recognition is extended to those members of the TRUSIX
  92. Working Group who participated in the Access Control List Subcommittee.
  93. Members of this subcommittee were:  Craig Rubin. AT&T Bell
  94. Laboratories (Co-Chair); Holly Traxler, National Computer Security
  95. Center (NCSC)/Institute for Defense Analyses (IDA) (Co-Chair);
  96. Bruce Calkins. NCSC; and Casey Schaufler9 Sun Microsystems.  Recognition
  97. is also extended to the following members of TRUSIX who provided
  98. input through discussion and comments: Bernie Badger, Harris Corporation;
  99. Caralyn Crescenzi, NCSC; Cynthia Irvine, Gemini Computers; Howard
  100. Israel, AT&T Bell Laboratories; Frank Knowles. MITRE; James
  101. Menendez. NCSC; Dr. Eric Roskos, IDA; Rick Siebenaler. NCSC, Lucy
  102. Stasiak, AT&T Bell Laboratories; Albert Tao, Gemini Computers;
  103. Dr. Charles Testa, Infosystems Technology, Incorporated (IT!),
  104. Mario Tinto, NCSC; Grant Wagner. NCSC; Larry Wehr, AT&T Bell
  105. Laboratories; and Bruce D. Wilner. IT!.
  106.  
  107.  
  108. Acknowledgment is also extended to the members of the POSIX P1003.6
  109. Security Subcommittee and to those members of the computer security
  110. community who contributed their time and expertise by actively
  111. participating in the review of this document.
  112. EXECUTIVE SUMMARY
  113.  
  114.  
  115.  
  116. The Trusted UNIX Working Group (TRUSIX) has examined the issues
  117. surrounding implementation of access control lists (ACLs) in the
  118. UNIX System and has identified a set of recommendations for implementors
  119. of ACL features.  These recommendations balance issues of compatibility
  120. with existing applications, ease of use and acceptability to the
  121. end user9 and architectural simplicity with the requirements for
  122. systems evaluated according to the Trusted Computer System Evaluation
  123. Criteria (TCSEC). The recommendations reflect the collected opinions
  124. and analyses of the participating vendors, evaluators, and researchers
  125. regarding implementation of ACL features.
  126.  
  127.  
  128. The recommendations of TRUSIX with regard to ACLs are as follows:
  129.  
  130.  •  ACLs are required for files9 IPC objects, and UNIX
  131. system domain sockets.
  132.  
  133.  
  134.  
  135.  • Access control for sockets that use name spaces other than
  136. those local to the UNIX system (UDP, TCP) must be addressed in
  137. the specification and evaluation of the system involved, and are
  138. neither explicitly recommended nor exempted.
  139.  
  140.  
  141.  
  142.  •  Access modes specifiable via ACLs should include read,
  143. write, and execute; other modes should be allowed to be added
  144. as desired, but no additional modes should be required to be supported.
  145.  •  Each ACL entry should specify permissions for either
  146. a user or a group, but not both.
  147.  •  Permissions granted by an ACL entry are masked by the
  148. group class file permission bits.
  149.  •  Multiple concurrent groups should be supported. In
  150. addition, some method of group subsetting should be provided.
  151.  It is recommended that this subsetting allow the user to become
  152. a member of only one group at login time, then to dynamically
  153. add groups to or delete groups from the working group set as required.
  154.  •  A system-defined ordering of ACL evaluation that evaluates
  155. from most specific to least specific is recommended. Where multiple
  156. concur~nt groups are in use, and more than one matching group
  157. is found in the ACL, permissions granted by all matching groups
  158. should be ORed together.
  159.  •  Modifications to mechanisms that change ownership,
  160. change the file permission bits, or access object attributes are
  161. not recommended.
  162.  
  163.  
  164.  
  165.  
  166. Existing mechanisms for object access, inquiry, and deletion should
  167. not be changed, and new parameters should not be added. Instead,
  168. new mechanisms should be created that make use of existing ones.-
  169. The interface for mechanisms that create objects should not be
  170. changed, except for the possible creation of a default ACL.
  171.  
  172.  •  For the new mechanisms that are added to support ACL
  173. operations, get/set operations should be used. These operations
  174. should be implemented via a single system call with command arguments
  175. to specify the various operations.  For commands at the user interface,
  176. the names getacl and setacl are recommended.
  177.  •  Named ACLs need not be supported.
  178.  •  Provision of default ACLs for file system objects is
  179. recommended, along with a user-specifiable mechanism for indicating
  180. whether or not they should be used.
  181.  •  Provision of default ACLs for [PC objects is not recommended.
  182.  •  Default ACLs should be provided on a per-directory
  183. basis.  Newly-created subdirectories should inherit the default
  184. ACL of the parent directory.
  185.  •  When a new object is created and ACL entries are attached
  186. via a default ACL.  the file group-class permission bits are not
  187. affected unless an explicit mechanism is provided.
  188.  
  189.  
  190.  
  191.  
  192. The preceding list summarizes the recommendations of the Trusted
  193. UNIX Working Group.  The  main body of this document discusses
  194. the rationale for these recommendations and gives further details
  195. of the recommendations themselves. The appendix, the TRUSIX ACL
  196. Worked Example, gives an example of how these recommendations
  197. might be implemented.
  198. introduction
  199.  
  200.  
  201.  
  202. The intent of this document is to explore the issues involved
  203. in extending the UNIX System discretionary  access control  (DAC)
  204. mechanism.  DAC is a means of controlling access to an object
  205. based on the identity of subjects and/or groups to which they
  206. belong. The controls are discretionary in the sense that they
  207. are chosen by the object owner.
  208.  
  209.  
  210. The DAC mechanism employed in the current UNIX System was designed
  211. for efficiency, flexibility. and ease of use. This mechanism allows
  212. and encourages the sharing of information, but at a very coarse
  213. granularity, via the use of file permission bits.  File permission
  214. bits are associated with three classes: owner (sometimes referred
  215. to as "user"), group. and other.  Access for each class
  216. is represented by a three-bit field allowing for read, write,
  217. and execute-permissions.
  218.  
  219.  
  220. Several methods exist for allowing discretionary access control
  221. on objects. These methods include capabilities, profiles. access
  222. control lists (ACLs), protection bits, and password DAC mechanisms.
  223. The intent was to select a DAC mechanism with finer granularity
  224. than the current file permission bits, while maximizing the compatibility
  225. with both the current mechanism and POSIX P1003.1. Review of the
  226.  
  227.  
  228. methods described in A Guide to Understanding Discretionary Access
  229. Control in Trusted Systems(2], and of the desired outcome, point
  230. to the use of ACLs. It should be noted that ACLs can be considered
  231. a straightforward extension of the existing
  232.  
  233.  • UNIX is a registered trademark of AT&T
  234.  
  235.  
  236.  
  237.  
  238. UNIX system protection bits, since the protection bits may be
  239. interpreted to be a limited form of an ACL, which always contains
  240. three entries.  It has been suggested that the fine granularity
  241. of coritrol provided by ACLs may be simulated in UNIX systems
  242. by using the group mechanism. Groups are lists of users which
  243. may be used to specify who may access a file. In the worst case9
  244. all possible combinations of users would have to be represented
  245. in order to fully implement these lists. This corresponds to (2'"M-1)
  246. groups, where M is the number of bits in the group-ID.  Since
  247. the number of possible combinations of users needed to implement
  248. this scheme for N users is (2"N-1), the maximum number of
  249. users which could effectively utilize such a system would be limited
  250. to the number of bits in the group-ID. This number (often 16 or
  251. 32) is an unreasonably small number for most UNIX systems and
  252. the management of the groups by users would be difficult. Also,
  253. this scheme does not allow for individual users in the lists to
  254. have different access rights. All users in the group would be
  255. forced to have the access rights given by the file group class
  256. permission bits. Some differences in access rights could be simulated
  257. by using the file other class permission bits, but not with the
  258. same functionality as provided by conventional ACLs.
  259.  
  260.  
  261. The DAC features explored in this rationale are based on the DAC
  262. features requested by customers, the class B3 DAC requirements
  263. described in the DoD Trusted  Computer  Systems Evaluation  Criteria
  264.  [1] (TCSEC),  and  the  DAC mechanisms used in existing trusted
  265. systems (e.g., Multics). Based on these inputs9 it has been determined
  266. that the current DAC mechanism in the UNIX System is adequate
  267. for most needs and that the only enhancement required is to allow
  268. reasonable, finer-grained control of objects. This provides the
  269. capability to share or deny access to individually specified users
  270. and/or groups and meets the class B3 requirements of the TCSEC.
  271.  
  272.  
  273. The issues explored in this document will deal primarily with
  274. ACLs. Much of the terminology has been adopted from the P1003.1
  275. document and the TCSEC; however, new terms will be defined when
  276. used. For most of the issues identified, alternative solutions
  277. are given along with a recommendation. Although an attempt was
  278. made to consider the' issues independently, it should be noted
  279. that sole of the issues are actually very dependent on each other
  280. and recommendations `made in some areas greatly influenced later
  281. recommendations.
  282. Goals
  283.  
  284.  
  285.  
  286. The primary goal in extending discretionary access control in
  287. the UNIX system is to provide a finer graninlarity of control
  288. in specifying user and/or group access to objects. This can be
  289. achieved through the addition of access control lists.  The following
  290. is a list of additional goals for the extended DAC mechanism:
  291.  
  292.  •  The mechanism should provide compatibility with the
  293. existing (currently P1003.1) and emerging POSIX standards and
  294. with the current  UNIX System DAC mechanism. In the unlikely event
  295. of a conflict between the current UNIX System DAC mechanism and
  296. POSIX, the POSIX interpretation will be used. In addition.  the
  297. semantics of existing interfaces should be maintained.
  298.  •  The following requirements for DAC in the TCSEC at
  299. class B3 should be fulfilled.  "The TCB shall define and
  300. control access between named users and named objects (e.g., files
  301. and programs) in the ADP system. The enforcement mechanism (e
  302. .g., access control lists) shall allow users to specify and control
  303. sharing of those objects, and shall provide controls to limit
  304. propagation of access rights. The discretionary access control
  305. mechanism shall either by explicit user action or by default,
  306. provide that objects are protected from unauthorized access. 
  307. These access controls shall be capable of specifying, for each
  308. named object, a list of named individuals and a list of groups
  309. of named individuals with their respective modes of access to
  310. that object.  Furthermore. for each such named object, it shall
  311. be possible to specify a list of named individuals and a list
  312. of groups of named individuals for which no access to the object
  313. is to be given.  Access permissions to an object by users not
  314. already possessing access permission shall only be assigned by
  315. authorized users."
  316.  •  Reasonable vendor extensions to the DAC mechanism should
  317. not be precluded.
  318.  
  319.  
  320.  
  321.  • For example, the specification of read, write and execute
  322. permissions should be supported.  Other permissions  should not
  323. be required  nor should they be precluded as extensions.
  324.  
  325.  
  326.  
  327.  •  A minimum set of new interfaces and error codes should
  328. be provided. The new command interfaces provided for the user
  329. must be easy to use and the existing interfaces should continue
  330. to work as expected.
  331.  •  Intermixing use of the existing and newly-defined DAC
  332. functions/commands should provide reasonable results. Security
  333. should be maximized by opting for more restrictive rather than
  334. less restrictive decisions ~h~ff' a choice must be made.
  335.  •  When changing DAC on an object, at no time shall access
  336. be more permissive than either the initial or resulting access.
  337.  
  338.  
  339.  
  340.  
  341.  
  342. ACLs On Objects
  343.  
  344.  
  345.  
  346. A system can support several different types of objects, e.g.,
  347. system objects, public objects, named objects. System objects
  348. are entities internal to the TCB (e.g., system data structures)
  349. not directly accessible by the normal user and, as such, do not
  350. require  discretionary  access control.  Public  objects are objects
  351. readable  but unmodifiable to the normal user (e.g., system clock)9
  352. and thus also do not require discretionary access control. Named
  353. objects are objects readable and modifiable at the user interface
  354. (e.g., text files). The TCSEC class B3 requirement for DAC states
  355. that access control must be enforced on all named objects in the
  356. system [1].  Although  there  may  be  some  variance  among 
  357. different  UNIX  system implementations, there are two common
  358. classes of named objects that require ACLs.  These classes are
  359. files (including regular. directory. special. and named pipes),
  360. and named IPC objects (including shared memory, message queues,
  361. semaphores, and sockets).
  362.  
  363.  
  364. It is these classes of objects that will be protected by the discretionary
  365. access control alternatives described later in the paper. It should
  366. be pointed out, however, that discretionary access can not always
  367. be completely determined solely by the file permission bits and
  368. the ACL associated with the object. It is possible to have objects
  369. which have been administratively configured for a specific access
  370. and thus not completely affected by user DAC, e.g., a file system
  371. mounted read-only. There are other instances where discretionary
  372. access of objects may be time-dependent and thus not completely
  373. based on a current DAC setting. Examples of this would be the
  374. inability to write a shared-text file while it is being executed
  375. or trying to execute a file while it is open for writing. These
  376. situations are acknowledged special cases and will  not  be  considered
  377.  in  the  general  discussion  of  determining  effective discretionary
  378. access.
  379. ACLs On IPC Objects
  380.  
  381.  
  382.  
  383. IPC objects are named objects and are thus require ACLs at class
  384. B3. Note that this does not include unnamed pipes which can only
  385. be used to connect related processes.  Although the semantics
  386. of IPC mechanisms are slightly different from those of file system
  387. objects, a DAC scheme similar to that used for file sky5~~~ objects
  388. should easily be adaptable to IPC objects.  For example, message
  389. queues utilize both a creator and an owner of an IPC object and
  390. maintain creator and owner UIDs and G[Ds (cuid,uid, cgid,gid).
  391. User access is checked against the cuid and the uid, and group
  392. access is checked against the cgid and gid.  This situation can
  393. easily be represented with ACLs by using additional ACL entries
  394. to represent the creator U[D and GID. Additionally, some access
  395. modes associated with file system objects, such as execute, may
  396. not be applicable to IPC objects.  This does not cause a problem
  397. as long as the modes are a subset of those defined for file system
  398. objects.
  399. ACLs On Sockets
  400.  
  401.  
  402.  
  403. Sockets are named objects and would thus require ACLs at class
  404. 83. UNIX system domain sockets use the file system name space
  405. for access control decisions and currently have file permission
  406. bits associated with them.  Thus, domain sockets would also need
  407. to have ACLs associated with them. Other types of sockets which
  408. use other name spaces (UDP. TCP) are currently not protected with
  409. any type of access control. Since it is not clear whether these
  410. types of sockets could currently be included in an evaluated configuration,
  411. they will not be addressed at this time.
  412. Additional Access Modes
  413.  
  414.  
  415.  
  416. Existing UNIX systems support three access modes: read, ivrite,
  417. and execute/search.  Additional access modes are conceivable,
  418. and may be convenient to add while adding ACLs. Various possibilities
  419. include:
  420.  
  421.  •  read attributes of object
  422.  •  write attributes of object
  423.  •  append only to object
  424.  •  truncate data of object
  425.  •  delete object
  426.  •  lock object
  427.  •  restrict setuid execution of object
  428.  •  restrict access of object based on time.
  429.  
  430.  
  431.  
  432.  
  433. Note that this is not an' all-inclusive list.
  434.  
  435.  
  436. In this and subsequent sections, alternative implementations of
  437. a given topic are examined, followed by the TRUSIX recommendation.
  438. Require Additional Access Modes
  439.  
  440.  
  441.  
  442. In this approach to handling additional access modes, new access
  443. modes would be defined and required. This limits the availability
  444. of compliant implementations and impacts compatibility.
  445. Prohibit Additional Access Modes
  446.  
  447.  
  448.  
  449. In this approach, new access modes would explicitly not be allowed.
  450. Due to loss of flexibility, compliance with this scheme would
  451. limit implementation.
  452.  
  453.  
  454. 43 Allow Additional Access Modes (With Control)
  455.  
  456.  
  457. In this approach, new access modes would not be defined. Instead.
  458. the concept of and mechanism for adding new access modes would
  459. be defined. This allows a vendor to produce whatever additional
  460. access modes are desired. Since the mechanism for doing so is
  461. defined there is little chance of collisions or contradictions.
  462.  The mechanisms must be defined and agreed upon by some regulating
  463. body which allocates access bits. Note no such body currently
  464. exists which has been tasked to allocate access bits.
  465. Allow Additional Access Modes (Without Control)
  466.  
  467.  
  468.  
  469. In this approach, additional access modes are neither defined
  470. nor precluded. This method allows a vendor to produce whatever
  471. additional access modes are desired, but there is no mechanism
  472. provided for adding new modes. There would be no control on the
  473. access modes vendors might add.
  474. Recommendation
  475.  
  476.  
  477.  
  478. We recommend allowing additional access modes, without control.
  479. There should be nothing precluding the addition of new access
  480. modes if desired.  However, since there is nothing currently in
  481. the POSIX P1003.1 standard concerning additional access modes,
  482. no new access modes or mechanisms need be defined.
  483. ACL Entry Type And Format
  484.  
  485.  
  486.  
  487. The manner in which an ACL entry refers to a user or group of
  488. users is an important factor in the usability of an ACL mechanism.
  489. The alternatives are to have an ACL entry contain either a user
  490. or group in an entry. or to have an ACL entry contain both a user
  491. and group. The issue is which of the alternatives is more suitable
  492. to a system utilizing ACLs.
  493. 5.1 User And Group Entries
  494.  
  495.  
  496.  
  497. A user and group entry contains a reference to both a specific
  498. user and a specific group together as a [UID,GID] pair. The UID-specific
  499. and GID-specific entries can be represented as special "wildcard"
  500. cases (denoted by *) meaning any user or group will match that
  501. entry. Using this method, an ACL entry may refer to one user in
  502. a particular group [UID,GID], one user in any group [UID,*], any
  503. user in a particular group [*,GID], or any user in any group [*,*]
  504. which is equivalent to the file other class permission bits. A
  505. typical ACL utilizing entries of this type might look like the
  506. following:
  507.  
  508.  
  509.                             user1.projA     rw-
  510.  
  511.  
  512.                             user2.projB     r-
  513.  
  514.  
  515.                             user3.*         rwx
  516.  
  517.  
  518.                                  *.projA    r-
  519.  
  520.  
  521.      *.*        ---
  522.  
  523.  
  524. Implementations of protected subsystems is the only clear example
  525. that suggests using user and group ACL entries as a pair. Using
  526. the UNIX system setgid-on-exec feature, it is possible to build
  527. protected subsystems. Consider the following example which makes
  528. use of this feature.
  529.  
  530.  
  531. A database of tapes is maintained in /etc/tapedata.  The database
  532. administrator (DBA) of the database wishes to produce a utility
  533. to control access to this database.  To begin with, there are
  534. some rules for dealing with the database.  Some users should have
  535. read and write access, others just read access, and still others
  536. should have no access to the database. Readers should only see
  537. data about their own tapes.  In addition, since other database
  538. utilities have poor error handling, all updates to the database
  539. need to be made in the correct format.
  540.  
  541.  
  542. The DBA has written a utility named tapedb which can read and
  543. update the database. /etc/tapedata and tapedb both have the group
  544. tape associated with them, and tapedb has the set-group-id bit
  545. on. The DBA has also created an ACL for letc/tapedata which contains
  546. the following entries:
  547.  
  548.  
  549.                             userl.tape      r-
  550.  
  551.  
  552.                             user2.tape      r-
  553.  
  554.  
  555.                             user3.tape      rv-
  556.  
  557.  
  558.                             user4.tape      rv-
  559.  
  560.  
  561.                                 *.*
  562.  
  563.  
  564. All users named in the ACL (in group tape) may read the database
  565.  Only user3 and user4 (in group tape) may update the database.
  566. If the only way for a user to be a member of group tape is by
  567. executing tapedb, then the DBA is satisfied that letc/tapedata
  568. is adequately protected.
  569.  
  570.  
  571. While this example suggests a useful application of user and group
  572. ACL entries, there are other ways to implement the example which
  573. do not require this ACL entry type functionality.  As described
  574. in the following section, the same effect can be achieved through
  575. ACLs containing user or group entries.`
  576.  
  577.  
  578. Additionally, identification by a user and group pair is not used
  579. in a UNIX System.  In some systems, a user is identified by a
  580. userID,group~ID pair. In Multics, for example, a user is identified
  581. by a user-ID, project-ID pair. where a project-ID is equivalent
  582. to a group-ID on the UNIX system. Userl in projA. on a Multics
  583. system, is distinct from userl in projB. Since Multics users do
  584. not have the capability to change groups9 the only way for a user
  585. to be identified with another project would be to log in with
  586. another group-ID. In UNIX systems, however. a user is really only
  587. identified by the user-ID.  Also, a user can easily change group-ID
  588. through the neivgrp command or be associated with several groups
  589. at the same time if using a system with multiple groups. Thus,
  590. controlling access for a user while in a specific group is not
  591. as useful in a UNIX system.
  592. User Or Group Entries
  593.  
  594.  
  595.  
  596. A user or group entry contains a reference to either a specific
  597. user or a specific group, but only one at a time. Consider the
  598. following example, where u indicates the user class, g indicates
  599. the group class, and o indicates the other class:
  600.  
  601.  
  602.                               u:userl      rw-
  603.  
  604.  
  605.                               u:user2      r-
  606.  
  607.  
  608.                               u:user3      rw-
  609.  
  610.  
  611.                               u:user4      rw-
  612.  
  613.  
  614.                               g:projA      r-
  615.  
  616.  
  617.                               g:projs      rw-
  618.  
  619.  
  620.                               o:           rw-
  621.  
  622.  
  623. To address the protected subsystem implementation, consider  again
  624. the tape database example described in the previous section. Rather
  625. than controlling access to the data, access can be controlled
  626. on two subprograms; one which reads data, the other which updates
  627. data. The ACL on the database, /etc/tapedata would be:
  628.  
  629.  
  630.                           g:tapereaders       r-
  631.  
  632.  
  633.                           g:tapewriters       rw-
  634.  
  635.  
  636. o:
  637.  
  638.  
  639. The user interface for access to the database is tapedb. The program
  640. tapedb is not setgid, however, it invokes two other programs,
  641. tapedbread and tapedb\vrite, that are setgid. Only users allowed
  642. to read the database have execute permission on topedbread,  while
  643. only those allowed to update the database may execute tapedb_write.
  644. The ACL on tapedbread would be:
  645.  
  646.  
  647.                               u:userl      --x
  648.  
  649.  
  650.                               u:user2      --x
  651.  
  652.  
  653.                               u:user3      --x
  654.  
  655.  
  656.                               u:user4      --x
  657.  
  658.  
  659. o:
  660.  
  661.  
  662. The ACL on tapedb_write would be:
  663.  
  664.  
  665.                               u:user3      --x
  666.  
  667.  
  668.                               u:user4      --x
  669.  
  670.  
  671. o:
  672.  
  673.  
  674. The program tapedb_read runs setgid to the group tapereaders,
  675. and the program taped_vrite runs setgid to the group tapewriters.
  676.  
  677.  
  678. Thus, the same protected subsystem can be provided through ACLs
  679. of type user or group.
  680.  
  681.  
  682. The main advantage of this scheme is that it provides more clarity
  683. for the user. This is considered to be a very important advantage
  684. as a user's understanding of such a mechanism is essential in
  685. promoting its correct usage. Additionally, this scheme removes
  686. the need for wildcard specifiers, thus eliminating the potential
  687. problems of picking an unused character as a specifier.
  688. Recommendation
  689.  
  690.  
  691.  
  692. User or group entries in ACLs are recommended. Since there is
  693. no clear need for the user-group paired entry scheme and there
  694. are several advantages to the user or group scheme, the user or
  695. group scheme is the preferred alternative. Examples were examined
  696. which claimed to require the use of user-group paired entries.
  697. One such example deals with protected subsystems as described
  698. above. Protected subsystems, a useful and important feature in
  699. a trusted system, can be implemented through other means not requiring
  700. user-group paired entries. We have "found that this is a
  701. limited class of applications and may be implemented with the
  702. user or group scheme with minimal effort. For UNIX systems with
  703. multiple groups, the user and group scheme becomes more difficult
  704. when determining access. Additionally, the user or group scheme
  705. follows the idea in UNIX systems that a user is only identified
  706. by user-ID and gives no special meaning to what a user can do
  707. while only in a certain group. Finally, although simplicity is
  708. a very subjective measure, in comparing the two alternatives the
  709. advantage of simplicity outweighs the ability to specify both
  710. a user and a group in a single entry.
  711. Relationship Of ACL And File Permission Bits
  712.  
  713.  
  714.  
  715. ACLs expand upon the discretionary access control facility which
  716. is already provided by the file permission bits. Although file
  717. permission bits do not meet the TCSEC class B3 requirement for
  718. DAC, they are sufficient for many uses and are the only mechanism
  719. available to existing applications.  Existing applications that
  720. are security-conscious  use file permission bits to control access.
  721.  The relationship between the ACL and the file permission bits
  722. is important to existing programs in order to maintain compatibility.
  723.  For example, use of chmod("object" 0) should continue
  724. to work, denying subsequent opens to an object. The following
  725. sections discuss possible approaches to handling the interaction
  726. of ACLs with file permission bits. Any references to default ACLs
  727. will be fully described in the Default ACLs section.
  728. ACL Always Replaces File Permission Bits (Pure ACL)
  729.  
  730.  
  731.  
  732. In this approach, the file permission bits are no longer consulted
  733. for DAC decisions.
  734.  
  735.  
  736. Instead, each object always has an ACL and the ACL completely
  737. determines access.  Consider the following example illustrating
  738. this scheme. Assume Userl and User2 are members of the group "GroupA"
  739. and User3 and User4 are not.
  740.  
  741.  
  742.                  file Owner/Group             User2/GroupA
  743.  
  744.  
  745.                  file permission bits:        rwxr-x-x
  746.  
  747.  
  748. ACL Entries:
  749.  
  750.  
  751.                           User1               rwx
  752.  
  753.  
  754.                           User2               r-
  755.  
  756.  
  757.                           User3               rwx
  758.  
  759.  
  760.                           User4        ---
  761.  
  762.  
  763. In this example the file permission bits would have no effect
  764. on the access control decision. User3 is able to read, write and
  765. execute the file. User2 is able to read it, but not to execute
  766. or write to the file. The file permission bits are completely
  767. ignored.
  768.  
  769.  
  770. The resulting pure ACL system does not have to worry about interactions
  771. between the ACL and the file permission bits, since the latter
  772. are not used for access control decisions.  A single, well defined
  773. access policy is employed.  Applications which should make use
  774. of DAC are forced to understand the new rules.  The major disadvantage
  775. of this scheme, however, is that compatibility is lost. Every
  776. DAC cognizant progr&m, and that should be every program that
  777. manipulates the discretionary access control information on an
  778. object needs to be changed to understand ACLs.
  779. Owner Selects ACL Or File Permission Bits
  780.  
  781.  
  782.  
  783. In this approach, either the file permission bits or the ACL are
  784. consulted for the access control decision on a per object basis.
  785. The owner determines whether the file permission bits or the ACL
  786. is used. The system call chmod returns an indicative error if
  787. the object has an ACL, but otherwise sets the file permission
  788. bits.  Consider the two following examples which illustrate this
  789. approach.  Once again assume Userl and User2 are members of the
  790. group "GroupA" and User3 and User4 are not.
  791.  
  792.  
  793. Example A (ACL selected):
  794.  
  795.  
  796.                  file Owner/Group             User2/GroupA
  797.  
  798.  
  799.                  file Permission bits:        rwxr-x-x
  800.  
  801.  
  802. ACL Entries:
  803.  
  804.  
  805.                           Userl               rwx
  806.  
  807.  
  808.                           User2               r-
  809.  
  810.  
  811.                           User3               rvx
  812.  
  813.  
  814. User4
  815.  
  816.  
  817. Since there is an ACL on this file the access control is the same
  818. as in the previous example.
  819.  
  820.  
  821. Example B (file permission bits selected):
  822.  
  823.  
  824.                  file Owner/Group             User2/GroupA
  825.  
  826.  
  827.                  file permission bits:        rwxr-x-X
  828.  
  829.  
  830.                  ACL Entries:                 NONE
  831.  
  832.  
  833. Since there are no ACL entries on this file the access control
  834. ~r determined by the permission bits. User2 (owner) has all access
  835. permissions to the file. Userl (a user in GroupA) is allowed read
  836. and execute access. User3 and User4 ("other" users)
  837. can only execute the file.
  838.  
  839.  
  840. The resulting system behaves like a file permission bit based
  841. system if no one ever sets ACLs and like the pure ACL system if
  842. a default ACL mechanism is in use. Thus, either environment can
  843. be supported.  The compatibility issues raised in the previous
  844. section apply here as well.  In addition, the programs have to
  845. determine which access control mechanism applies to each object
  846. created and set the DAC accordingly.
  847. Independent ACL And File Permission Bits (AND)
  848.  
  849.  
  850.  
  851. In this approach, both the file permission bits and the ACL are
  852. consulted for the discretionary access control decision on a per
  853. object basis. Access is granted if and only if it is granted by
  854. both the ACL and the file permission bits.  Consider the following
  855. example9 which illustrates this approach. For this example9 assume
  856. only User2 is in GroupA.
  857.  
  858.  
  859.                  file Owner/Group             User2/GroupA
  860.  
  861.  
  862.                  file permission bits:        rwxr-x-x
  863.  
  864.  
  865. ACL Entries:
  866.  
  867.  
  868.                           Userl               rwx
  869.  
  870.  
  871.                           User2               r-
  872.  
  873.  
  874.                           User3               Tx
  875.  
  876.  
  877. User4
  878.  
  879.  
  880. In the example above, the file permission bits imply that Userl
  881. has execute permission, whereas the permissions specified in the
  882. ACL imply that Userl has full access. Without knowing which group
  883. User 1 is in, one cannot predict whether or not Userl can read
  884. the file. If Userl is in group GroupA, then Userl will have read
  885. and execute permissions. If Userl is not in group GroupA, then
  886. only execute permission will be granted.  Similarly, without knowing
  887. User3"s group, one cannot predict whether or not User3 has
  888. read access. User4 will have no possibility of access, due to
  889. no permissions specified in the ACL entry. As the example illustrates,
  890. there is no way to get a full ACL view with this scheme.
  891.  
  892.  
  893. With this scheme, some compatibility is maintained. Calls to chmod
  894. have the desired effect from the restrictive point of view. ACL
  895. entries can further restrict access.  Making use of the ACL as
  896. the effective access control mechanism requires that the file
  897. permission bits be set wide-open (i.e., read, write, and execute
  898. bits are set for user, group and other). In situations where ACLs
  899. are not properly set, a new object will become generally accessible.
  900. Likewise, if the ACL is removed then the object will again be
  901. generally accessible.  This scheme also allows for misleading
  902. status information given to programs which only use the existing
  903. mechanism.
  904. Independent ACL And File Permission Bits (OR)
  905.  
  906.  
  907.  
  908. In this approach, both the file permission bits and the ACL are
  909. consulted for the discretionary access control decision on a per
  910. object basis. Access is granted if it is granted by either the
  911. ACL or the file permission bits. The ACL is used to grant access
  912. beyond what is set in the file permission bits.
  913.  
  914.  
  915. Consider the following example illustrating this approach. Assume
  916. only User2 is in GroupA.
  917.  
  918.  
  919.                  file Owner/Group             vser2/GroupA
  920.  
  921.  
  922.                  file permission bits:        rwxr-x-X
  923.  
  924.  
  925. ACL EntrieS:
  926.  
  927.  
  928.                           insert              rwx
  929.  
  930.  
  931.                           inser2              r-
  932.  
  933.  
  934.                           inser3              rwx
  935.  
  936.  
  937. User4
  938.  
  939.  
  940. Userl, User2, and User3 have read, write, and execute access.
  941. User4 has execute access.
  942.  
  943.  
  944. Again, some compatibility is maintained. Calls to chmod have the
  945. desired effect from the permissive point of view. The previous
  946. alternative's problem of leaving the permission bits wide-open
  947. is thus avoided.
  948.  
  949.  
  950. The problem with this scheme, however, is that a chmod call which
  951. would deny all access (chmod("object", 0)) in a system
  952. without ACLs will not do so here.
  953. File Permission Bits Contained Within ACL
  954.  
  955.  
  956.  
  957. In this approach, only the ACL is consulted for discretionary
  958. access control decisions. The file permission bits are replaced
  959. by three "base" entries in the ACL.  Calls to chmod
  960. modify the owner, group, and other entries contained in the ACL.
  961.  
  962.  
  963. Calls to stat read this information from the ACL.
  964.  
  965.  
  966. In the following two examples assume the owner entry is evaluatefl
  967. before additional user entries, and the group entry is evaluated
  968. before additional gr1oup entries.
  969.  
  970.  
  971. Example A:
  972.  
  973.  
  974.                  file Owner/Group             inser2/GroupA
  975.  
  976.  
  977.                  file permission bits:        rwxr-x-x
  978.  
  979.  
  980. ACL Entries:
  981.  
  982.  
  983.                           owner               rwx
  984.  
  985.  
  986.                           User1               rvx
  987.  
  988.  
  989.                           User2               r-
  990.  
  991.  
  992.                           User3               r-x
  993.  
  994.  • User4
  995.  
  996.  
  997.  
  998.  
  999.                           group               r-x
  1000.  
  1001.  
  1002.                           other               --x
  1003.  
  1004.  
  1005. In this example. it is not clear what permissions User2 is to
  1006. be granted, since a particular method for determining owner access
  1007. has not been specified for the case where an additional user entry
  1008. also names the owner. User2 could be granted read, write, and
  1009. execute access as the owner. read access only, as per the explicit
  1010. entry for User2, or some combination of the two (e.g., the AND
  1011. or OR of the two). Userl, User3, and User4 get their access from
  1012. their ACL entries.
  1013.  
  1014.  
  1015. Example B: (After a chmod("object", 0))
  1016.  
  1017.  • file Owner/Group             inser2/GroupA
  1018.  • file permission bits:
  1019.  
  1020.  
  1021.  
  1022.  
  1023. ACL Entries:
  1024.  
  1025.  
  1026. owner
  1027.  
  1028.  
  1029.                           User1               rwx
  1030.  
  1031.  
  1032.                           User2               r-
  1033.  
  1034.  
  1035.                           User3               r-x
  1036.  
  1037.  • User4
  1038.  • group               -
  1039.  • other
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047. Changing the file permission bits to zero does not change the
  1048. permissions granted to Userl, User3, and User4, since their access
  1049. is based on ACL entries. User2's access may change depending on
  1050. how owner access is determined when additional user entries naming
  1051. the owner also exist.
  1052.  
  1053.  
  1054. If no additional entries are added to the ACLs, this system looks
  1055. like a system without ACLs. The literal meaning of the file permission
  1056. bits is preserved in the ACL.
  1057.  
  1058.  •  As in the previous alternative, however, a chmod call
  1059. which would deny all access (cbmod("object", 0)) in
  1060. a system without ACLs will not do so here.
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. ACL Masked By File Permission/ Bits
  1067.  
  1068.  
  1069.  
  1070. In this approach, both the file permission bits and the ACL are
  1071. used for determining the discretionary access control decision.
  1072. The access indicated in the ACL entry is logically ANDed (masked)
  1073. with one or more of the file permission bit classes (file owner,
  1074. file group, or file other class) to determine the effective DAC
  1075. permission.
  1076.  
  1077.  
  1078. Example:
  1079.  
  1080.  
  1081.                  file Owner/Group             User2/GroupA
  1082.  
  1083.  
  1084.                  file permission bits:        rwxr-x-x
  1085.  
  1086.  
  1087. ACL Entries:
  1088.  
  1089.  
  1090.                           User1               rwx
  1091.  
  1092.  
  1093.                           User2               r-
  1094.  
  1095.  
  1096.                           User3               rx
  1097.  
  1098.  
  1099.                           User4               ---
  1100.  
  1101.  
  1102. Assume that the group file permission bits are chosen as the mask,
  1103. i.e., all ACL entries will be ANDed against the file group class
  1104. permission bits. User2, being the owner, gets read, write, and
  1105. execute access to the file. User3 is allowed read and execute
  1106. access.  Userl is allowed read and execute access, the write access
  1107. is disallowed by the file permission bits. User4 is not allowed
  1108. any access to the file.  Calls to chmod have the desired effect
  1109. from the restrictive point of view but not necessarily from the
  1110. permissive point of view. Since the bits of the masked field will
  1111. most likely be set wide-open, the literal meaning of the field
  1112. chosen for the mask appears to be lost. The POSIX standard, however,
  1113. allows for the extended meaning of the group class permission.
  1114. bits.
  1115. Recommendation
  1116.  
  1117.  
  1118.  
  1119. We recommend the AcL Masked By File Permission Bits approach.
  1120. This is the most reasonable  approach when trying to balance security
  1121. and compatibility.  The question of designating the masking field
  1122. must still be resolved. The file group class permission bits are
  1123. the preferred masking field, even though they encourage permissive
  1124. default access by the owning group. This choice must be made because
  1125. the use of the file owner class would cause compatibility problems
  1126. in programs which attempt to establish "owner-only"
  1127. access, whereas the designation of the file other class could
  1128. leave objects open to attack were an ACL removed or never present.
  1129. An additional option of masking user entries with the file owner
  1130. class permission bits and group entries with the file group class
  1131. permission bits has the same disadvantages as masking against
  1132. only the file owner class. When masking  against the file group
  1133. class, the permissions indicate the least upper bound of the permissions
  1134. allowed for the ACL entries and the user and other fields retain
  1135. their previous semantics.
  1136.  
  1137.  
  1138. To summarize the approaches identified in this section:
  1139.  
  1140.  
  1141. The ACL Masked By File Permission Bits approach is a compromise
  1142. for both security and compatibility.
  1143.  
  1144.  
  1145. The Independent ACL And File Permission Bits (AND) approach suffers
  1146. from the serious flaw that the file permission bits must be set
  1147. very permissively in order to allow the ACL entries to predominate
  1148. in the discretionary access calculation.  A simple mistake in
  1149. setting the ACL could grant object access to significantly more
  1150. users than was intended.
  1151.  
  1152.  
  1153. The Independent ACL And File Permission Bits (OR) approach may
  1154. require that both ACL and the file permission bits be changed
  1155. in order to deny a particular access.  Thus, existing programs
  1156. could believe that they had prevented access when they, in fact,
  1157. had not. Similarly, in the File Permission Bits Contained Within
  1158. ACL approach, removing "other" permission might not
  1159. have the desired effect9 since, the owner, group, and other entries
  1160. may not be the only ones in the ACL. In neither case does a call
  1161. to chmod with a zero argument unequivocally revoke access from
  1162. all users as might be expected.
  1163.  
  1164.  
  1165. Whichever DAC scheme is ultimately selected, an appropriate balance
  1166. must be struck between the mutually conflicting concerns of compatibility
  1167. and security. In a DAC scheme where chmod cooperates with ACLs,
  1168. chmod must not grant inappropriate access or require unreasonable
  1169. (i.e., permissive public access) defaults.
  1170.  
  1171.  
  1172. Barring compatibility, the alternatives of ACLs replacing file
  1173. permission bits (Pure ACLs and On Demand) would be the most elegant
  1174. way of enhancing DAC for UNIX systems. By abandoning file permission
  1175. bits, however, these schemes have been rendered incompatible with
  1176. existing systems. Thus, they are not considered for a POSIX-compliant
  1177. UNIX system DAC scheme.
  1178. Group Semantics
  1179.  
  1180.  
  1181.  
  1182. There are various ways of using the UNIX system group mechanism
  1183. when grouping system users. In designing ACLs it is important
  1184. to understand the possible semantics and provide enough flexibility
  1185. to properly support these semantics. Initially, there are no restrictions
  1186. on how users can be grouped. Various possibilities include:
  1187.  
  1188.  •  a shorthand way of referring to groups of subjects
  1189.  •  a method of grouping project work by group access rights
  1190.  •  privileged roles
  1191.  •  accountability (file ownership)
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199. The issue arises. however, of how to deal with user membership
  1200. when considering these possible grouping mechanisms. For example,
  1201. should a user be permitted to be a member of more than one group
  1202. at any given time? If so. should there be a mechanism provided
  1203. to allow the user to control group membership? These issues will
  1204. be addressed in the following sections.
  1205. Single Group Membership
  1206.  
  1207.  
  1208.  
  1209. Under a single membership scheme, a user can only be a member
  1210. of one specific group at any given time. All discretionary access
  1211. checks will be made with respect to the user's OlD and a single
  1212. GID. A user will only be able to change his/her group through
  1213. the use of the newgrp command. This scheme is easy to implement
  1214. and introduces no additional complexity with respect to evaluating
  1215. access within an ACL.  Additionally. it would certainly be acceptable
  1216. in a class B3 system.
  1217. Multiple Concurrent Group Membership
  1218.  
  1219.  
  1220.  
  1221. Under a multiple concurrent group scheme, a user can be a member
  1222. of more than one group at the same time.  This scheme introduces
  1223. some complexity when evaluating user access by allowing more than
  1224. one ACL entry of equal specificity to apply to a user simultaneously.
  1225. For example, if a user is a member of several groups at the same
  1226. time and tries to access an object with an ACL containing entries
  1227. which match the user on more than one group, what will the resulting
  1228. access be? There are several ways of determining the resulting
  1229. access in such a case. These are discussed under ACL Evaluation.
  1230.  
  1231.  
  1232. Another concern with the use of multiple concurrent groups is
  1233. the possibility of violating the least privilege principle. With
  1234. multiple concurrent groups if a user is in several groups at once,
  1235. he/she is granted access to all of those groups at all times rather
  1236. than to just the ones he/she needs at any given time. This could
  1237. be contrary to the idea of a user having a minimal set of privileges
  1238. necessary to perform a particular function at any given time.
  1239.  
  1240.  
  1241. It can be argued, however, that the least privilege requirement
  1242. in the TCSEC only applies to TCB architecture, making this issue
  1243. irrelevant for DAC. On the other hand there may be a problem with
  1244. a system which implements privileged roles through the group mechanism.
  1245. The TCSEC class B3 Trusted Facility Management requirement  states
  1246.  that  separate  roles  must  be  assigned  to  operator  and
  1247. adinistrator functions and that each role be restricted to performing
  1248. only those functions necessary for that role. Given a system,
  1249. therefore, which uses the group mechanism to assign roles and
  1250. grant access basedon role identity to parts of the system which
  1251. would otherwise be inaccessible, it is clear that least privilege
  1252. could be violated through the use of multiple concurrent groups.
  1253. The violation would occur if the user who was a member of the
  1254. group assigned to a privileged role could also be a member of
  1255. one or more additional groups. Proper administration of these
  1256. privileged groups, however. could still allow for the use of multiple
  1257. groups. but a subsetting capability, as described in the next
  1258. subsection9 would then be required.
  1259.  
  1260.  
  1261. Improperly  controlled  multiple  concurrent  groups  with  groups
  1262.  representing privileged roles could therefore be a violation
  1263. of the least privilege principle. This would result in a failure
  1264. to meet the class B3 requirements. This is only one specific implementation,
  1265. however, and it is certainly conceivable that multiple concurrent
  1266. groups could be implemented in such a way as to not be a violation
  1267. of least privilege.  The multiple concurrent group scheme is currently
  1268. a feature in some UNIX systems and is thought to be an extremely
  1269. useful and necessary feature to those who use it.
  1270.  
  1271.  
  1272. Multiple concurrent groups would also be compatible with the POSIX
  1273. standard
  1274. Multiple Concurrent Groups With Subsetting
  1275.  
  1276.  
  1277.  
  1278. Another problem associated with multiple concurrent groups arises
  1279. from the fact that currently when a user logs on to a system he/she
  1280. automatically becomes a member of all of the groups that he/she
  1281. is allowed membership in. There is no way for the user to only
  1282. be active in a subset of his/her possible group set. Although
  1283. there is no explicit requirement in the TCSEC precluding this,
  1284. the TCSEC does seem to imply that a user should by default have
  1285. a minimal amount of access rights atlogin.
  1286.  
  1287.  
  1288. There are several ways of approaching this problem; any of these
  1289. methods would be a possible and acceptable means of resolving
  1290. this problem. First, it is necessary to consider whether a user
  1291. should be able to add or delete groups from his/her group set
  1292. and if so, with what restrictions. A user should certainly not
  1293. be allowed to add groups for which he/she is not authorized. 
  1294. Therefore each user should have an "allowable group set"
  1295. which consists of all groups that user has been given authorization
  1296. to be a member of. Adding groups other than those which appear
  1297. in this allowable group set would be unacceptable.
  1298.  
  1299.  
  1300. There are at least two ways to allow a user to work with a subset
  1301. of his/her allowable group set. The first would be to keep the
  1302. current scheme where a user becomes a member of all of his/her
  1303. groups at login, but provide the user with a means (through some
  1304. system call or command) to drop specific groups if desired and
  1305. work as a member of some subset of his/her allowable group set.
  1306. A command would allow a user the capability but require an explicit
  1307. action to do so. A system call, on the other hand, would provide
  1308. the means for restriction through a program which could be set
  1309. up to run automatically for the user. This would mean, however,
  1310. that the set of groups would either be hardcoded into the program
  1311. or be set through some type of configuration file. Another possible
  1312. approach would be to provide a mechanism that would cause a program's
  1313. groups to be restricted when that program is executed.  Although
  1314. this eliminates the user having to remember to restrict his/her
  1315. groups or having to hardcode a group set into a program, it would
  1316. add further complexity to the system.
  1317. Recommendation
  1318.  
  1319.  
  1320.  
  1321. We recommend that the multiple concurrent group capability be
  1322. provided along with some method of subsetting. The preferred method
  1323. would be to only allow the user to become a member of one group
  1324. at login and provide him/her with a means of dynamically adding/deleting
  1325. to his/her working group set. This recommendation, of course,
  1326. may conflict with implementations which use the group mechanism
  1327. for privilege roles.
  1328. ACL Evaluation
  1329.  
  1330.  
  1331.  
  1332. This issue deals with how an ACL is evaluated to determine access
  1333. rights of a subject to a particular object.  There are several
  1334. possible ordering methods for ACL evaluation, as well as several
  1335. different ways to evaluate multiple group entries.  Two levels
  1336. of ordering must actually be considered when deriving an ACL evaluation
  1337. scheme; the ordering of the classes (user, group, other), and
  1338. then the ordering of the entries within each class.
  1339. Ordering Of Classes
  1340.  
  1341.  
  1342.  
  1343. It would certainly be possible to specify an ordering of any combination
  1344. of the the three classes, user, group, and other. However, since
  1345. both the POSIX standard and all current UNIX systems specify a
  1346. "user, then group, then other" ordering, (or most-to-least
  1347. specific), when evaluating access with permissiori bits, this
  1348. ordering should be maintained for ACLs as well.
  1349.  
  1350.  
  1351. The method of evaluating an ACL in a most-to-least specific manner
  1352. can be described as follows. The owner identity of the object
  1353. is first checked against the effective identity of the subject.
  1354. If there is a match the search stops. Next, a check is made against
  1355. the owning group identity of the object and the effective group
  1356. of the subject. If there is a match and the subject does not have
  1357. multiple groups, the search stops. Otherwise the rest of the group
  1358. entries are searched next. If the subject has multiple groups,
  1359. the group entries are evaluated as presented in the Multiple Group
  1360. Evaluation section, otherwise they are searched in order as the
  1361. user entries are.  Finally, if no user or group entries were found
  1362. to match the effective identity of the subject, access is determined
  1363. based on the other entry.
  1364.  
  1365.  
  1366. For the following discussion on the ordering of ACL entries9 it
  1367. will be assumed that the classes will be ordered and follow this
  1368. most-to-least specific regime.
  1369. User-Defined Ordering
  1370.  
  1371.  
  1372.  
  1373. In this method, entries are considered according to the ordering
  1374. given by the user.  The first entry as specified by the user is
  1375. considered first, the second entry next, and soon.
  1376.  
  1377.  
  1378. As long as the "user, then group, then other" order
  1379. is followed, the only security relevant problem with this method
  1380. occurs when evaluating group entries with multiple groups. If
  1381. a user is a member of multiple groups and matches more than one
  1382. of the group entries, the resulting access may be dependent upon
  1383. the ordering of the group entries. See the Multiple Group Evaluation
  1384. section for various possibilities.
  1385.  
  1386.  
  1387. Unless all matching group entries are considered when determining
  1388. access, the burden is placed on the user to correctly order the
  1389. group entries.  This method may appear to be more convenient for
  1390. users, however, it may require the user to have extensive knowledge
  1391. of group membership. Additionally, it does not allow for very
  1392. efficient access evaluation as discussed in the following section.
  1393. System-Defined Ordering
  1394.  
  1395.  
  1396.  
  1397. In this method, entries are considered according to a system-defined
  1398. ordering.  Although the user does not have the flexibility of
  1399. choosing an arbitrary order of entries, a system-defined ordering
  1400. gives consistency to ACLs throughout the system and may also allow
  1401. for quicker access determination.
  1402.  
  1403.  
  1404. The system may use any of a variety of ordering methods, two of
  1405. which are alphabetical ordering by user or group name and numeric
  1406. ordering by user or group ID. An ordering of lowest to highest
  1407. UID or GID, or vice-versa, is recommended as it provides an efficient
  1408. way to check for redundant entries.  Redundant entries should
  1409. not be allowed in an ACL.
  1410.  
  1411.  
  1412. It is important to mention that actual sorting need not be done
  1413. by the kernel itself as long as the kernel enforces the specified
  1414. ordering. In other words, the sorting can be achieved through
  1415. the use of library routines.  The ACL commands would automatically
  1416. use the library sorting routines and users would also be encouraged
  1417. to do so when writing their own programs which manipulate ACLs.
  1418. When an ACL is passed to the kernel, the kernel verifies that
  1419. the entries are sorted or else a failure will occur.  In this
  1420. manner, efficiency is achieved while still enforcing a system-defined
  1421. ordering.
  1422.  
  1423.  
  1424. This alternative is simple. reduces the possibility of user error,
  1425. and allows for more efficient access determination.
  1426. Multiple Group Evaluation
  1427.  
  1428.  
  1429.  
  1430. When a subject is a member of multiple groups, there are several
  1431. ways the group entries may be evaluated, regardless of the ordering
  1432. of the entries.  The following methods may be used to evaluate
  1433. access when multiple groups are used:
  1434.  
  1435.  
  1436. The first entry which matches one of the subject's groups might
  1437. be used to determine access. While this is an efficient method,
  1438. it does not take notice of the possibility of other groups granting
  1439. access.
  1440.  
  1441.  
  1442. The entry which matches one of the subject's groups and grants
  1443. the least access might be used. This method does not recognize
  1444. the possibility that all the groups together might grant or deny
  1445. the desired access.
  1446.  
  1447.  
  1448. The entry which matches one of the subject's groups and grants
  1449. the most access might be used.  This method also does not recognize
  1450. the possibility that all the groups together might grant or deny
  1451. access.
  1452.  
  1453.  
  1454. ANDing the permissions of all the entries which match groups of
  1455. the subject is another possible method. This approach may be considered
  1456. too restrictive, since even one entry which grants access may
  1457. be overruled by other entries which deny access.
  1458.  
  1459.  
  1460. ORing the permissions of all the entries which match groups of
  1461. the subject is also a possibility.  This method may be considered
  1462. too permissive, since the maximum permissions allowed by all the
  1463. matching entries taken together is the result.
  1464.  
  1465.  
  1466. However, the same effect can be achieved currently, through the
  1467. user simply invoking the newgrp command to change to the group
  1468. with the d1esired access or by opening the same file twice from
  1469. two different groups which together provide the desired access.
  1470. Recommendation
  1471.  
  1472.  
  1473.  
  1474. A system-defined ordering which evaluates ACLs entries from most-to-least
  1475. specific is recommended.  Since multiple groups were designed
  1476. to be permissive and permissive results can be achieved through
  1477. other means anyway, the method which ORs the permissions of all
  1478. matching group entries is recommended for systems implementing
  1479. multiple groups.
  1480.  
  1481.  
  1482. Concern has been expressed that this scheme violates the wording
  1483. in the TCSEC, for DAC at class B3. The TCSEC states: Furthermore,
  1484. for each such named object, it shall be possible to specify a
  1485. list of named individuals and a list of groups of named individuals
  1486. for tvhich no access to the object is to be given. The ORing of
  1487. groups, however, does not present a conflict with the class B3
  1488. DAC requirement, as it still allows the user to specify groups
  1489. that shall have no access.
  1490. DAC Compatibility
  1491.  
  1492.  
  1493.  
  1494. Designing an ACL mechanism requires that attention be given to
  1495. the use of system calls which check or modify the existing DAC
  1496. mechanisms, and to the additional use of ACL mechanisms in system
  1497. calls. The classes of DAC mechanisms which return or change the
  1498. value of the discretionary access control information are those
  1499. mechanisms which: change ownership of an object9 change the file
  1500. permission bits.  create objects, access object attributes. and
  1501. access object data. Each of these classes will now be examined
  1502. and a determination will be made of what changes, if any9 are
  1503. required for inclusion in a system with ACLs. For each class,
  1504. we provide alternative solutions and identify the preferred choice.
  1505. Changing Ownership Of An Object
  1506.  
  1507.  
  1508.  
  1509. Mechanisms which change ownership of an object (e.g., chown, msgctl,
  1510. semctl, shmctl) could create a new user or group entry for the
  1511. object owner or group, with the same access permissions as the
  1512. original entry for the object owner or group. The original entry
  1513. would become an additional user or group entry. The problem with
  1514. this alternative is that by leaving the original entry for the
  1515. object owner or group behind as an additional user or group entry,
  1516. the mechanism will always create an ACL for an object which did
  1517. not have one to begin with.
  1518.  
  1519.  
  1520. The preferred alternative is for these calls to suffer no additional
  1521. side effects due to the presence of ACLs. This can be achieved
  1522. by not storing explicit IDs in the owner and owning group ACL
  1523. entries. An advantage of this altern'ative is that the ACL entries
  1524. for object owner and object owning group can be readily distinguished
  1525. syntactically from the other user and group entries.
  1526. Changing The File Permission Bits
  1527.  
  1528.  
  1529.  
  1530. Mechanisms which change the file permission bits (e.g., chmod,
  1531. msgctl, semctl, shmctl) might be changed so that they fail, or
  1532. partially fail, when presented with an object that has an ACL.
  1533.  
  1534.  
  1535. Complete failure is a poor alternative since these mechanisms
  1536. change the file mode, not just the file permission bits. For example,
  1537. a program should be able to do a legitimate operation such as
  1538. changing the setgid bit on any file.  Partial failure means that
  1539. these mechanisms would make the requested changes but return an
  1540. error value different from -1. This is a poor alternative for
  1541. two reasons: it does not make good sense to succeed while returning
  1542. failure. and programs often do not differentiate between error
  1543. return values.
  1544.  
  1545.  
  1546. Other alternatives attempt to minimize surprises to the caller
  1547. by changing ACL entries. The first of these alternatives is to
  1548. mask the access permissions in all the object's additional entries.
  1549.  Access permissions for entries with specific user and specific
  1550. group are ANDed with the supplied user and group access permissions.
  1551.  Access permissions for entries with only a specific user are
  1552. ANDed with supplied permissions for the user, and permissions
  1553. for entries with only a specific group are ANDed with supplied
  1554.  permissions  for the group.  While  this  meets POSIX requirements,
  1555. programs that wish to change only the file mode (non-access) bits
  1556. will have the masking occur as an undesirable side effect.  Another
  1557. alternative is to disable the additional entries. This implicitly
  1558. requires a new mechanism to enable entries that have been disabled.
  1559.  POSIX requirements are also satisfied by this alternative, but
  1560. the same problems exist as in the previous alternative; programs
  1561. using these mechanisms to change the non-access file mode bits
  1562. will have entries disabled as an undesirable side effect.  Still
  1563. another alternative is to delete the additional entries.  This
  1564. has similar advantages and disadvantages as ACL entry disabling.
  1565. It is simpler since there is no need for an ACL entry enabling
  1566. mechanism.  Information given by the user, however, is deleted
  1567. without warning.
  1568.  
  1569.  
  1570. The preferred method is to make no changes to these mechanisms.
  1571. The mechanisms will affect only file permission bits and ACL entries
  1572. for the object owner or group.  While this does not provide non-ACL
  1573. cognizant programs with expected results for operations on objects
  1574. with ACLs, it is not perceived as a serious problem.  This alternative
  1575. is consistent with the preferred alternative for mechanisms which
  1576. access object attributes as well (see below).
  1577. Creating Objects
  1578.  
  1579.  
  1580.  
  1581. Mechanisms which create or truncate objects (e.g., creat, open,
  1582. mkfifo, mkdir, msgget, semget, shmget) should work as they currently
  1583. do, except that they may create an ACL as part of the default
  1584. ACL mechanism. Please refer to the section on default ACLs for
  1585. more information. Note that default protection on newly-created
  1586. objects will be accomplished via the umask and/or default ACLs.
  1587.  
  1588.  
  1589. It may also be desirable to add other types of ACL features to
  1590. mechanisms.  For example, one might wish to add the capability
  1591. during file creation to adopt a specific ACL. For changes of this
  1592. type, parameters of existing mechanisms should not be changed9
  1593. and new parameters should not be added.  New mechanisms should
  1594. be created which make use of existing ones.  For example. creat
  1595. may need to be modified to take ACLs into account, but the parameter
  1596. list should not change.  Instead of adding an ACL parameter to
  1597. creat. a new system call (i.e.. with some other name) should be
  1598. used. which takes the ACL as a parameter and then uses creat.
  1599. Accessing Object Attributes
  1600.  
  1601.  
  1602.  
  1603. Mechanisms which access object attributes (e.g. stat, msgctl,
  1604. semctl, shmctl) could be modified to fail when applied to an object
  1605. with an ACL. This is an unacceptable alternative since these mechanisms
  1606. return more information than simply the file mode.  Thus. non-functionality
  1607. would require a new mechanism to return the additional information
  1608. for objects with ACLs.
  1609.  
  1610.  
  1611. Another alternative is to find all the entries in the ACL that
  1612. apply to the user-ID and group-ID of the subject, just like a
  1613. permissive access check. Then OR all the associated permissions
  1614. together, and return the results in the appropriate file permission
  1615. bits (user, group, and other). While this alternative integrates
  1616. the idea of ACLs into mechanisms that access object attributes9
  1617. the context of the mechanisms affects the result returned to the
  1618. point where the meaning of what the mechanisms return is somewhat
  1619. clouded.
  1620.  
  1621.  
  1622. The preferred alternative is to make no changes to these mechanisms.
  1623.  The mechanisms will continue to return the file permission bits
  1624. as if ACLs did not exist.  Another mechanism must then be used
  1625. to find out if the file has an ACL, and if so, what its entries
  1626. are. While this alternative does not provide all information to
  1627. subjects that don't know about ACLs, it does not change the current
  1628. behavior of these mechanisms.
  1629. Accessing Object Data
  1630.  
  1631.  
  1632.  
  1633. There are a number of system calls which will need to have AFL
  1634. functionality added to them (i.e., for access checking). These
  1635. calls include all those taking file system object names as parameters,
  1636. as well as those IPC mechanisms which perform access checks. Examples
  1637. of some of these calls are: open, msgsnd, msgrcv, semop, and shmat.
  1638.  
  1639.  
  1640. It is also important for portability that programs use the available
  1641. access control mechanisms in an appropriate manner, so that the
  1642. security policy is interpreted correctly. For instance, at the
  1643. system call level, the permission information returned by the
  1644. use of stat may not be sufficient to determine allowed access;
  1645. other information such as ACL contents may have to be evaluated
  1646. as well.
  1647. Recommendation
  1648.  
  1649.  
  1650.  
  1651. The following is a summary of the preferred alternatives stated
  1652. in this section.  Regarding compatibility with existing DAC mechanisms
  1653. that either 1)  change ownership or group of an object. 2) change
  1654. file permission bits, or 3) access object attributes should remain
  1655. unchanged and not affect an existing ACL on the object or create
  1656. an ACL where one did not exist before.
  1657.  
  1658.  
  1659. Regarding the addition of ACL functionality, existing mechanisms
  1660. should not be changed, and new parameters should not be added.
  1661. Instead, new mechanisms should be created which make use of existing
  1662. ones.
  1663. ACL System Calls And Commands
  1664.  
  1665.  
  1666.  
  1667. This issue addresses what the naming conventions and functionality
  1668. for ACL system calls and commands should be.
  1669.  
  1670.  
  1671. For system calls, there are at least two alternative types of
  1672. designs. Each depends on how the ACL is viewed.  In one approach,
  1673. the ACL is a series of independent records which can be individually
  1674. manipulated using calls similar to open, read, write. and close.
  1675. This approach has a nice parallel to the way files are read and
  1676. written, but may be viewed as overly complicated given the relative
  1677. infrequency of ACL modification. In the other approach. the ACL
  1678. is considered a single unit and is not changed record-by-record,
  1679. but instead always manipulated as a whole. This approach uses
  1680. a "get" and "set" concept for ACL operations,
  1681. where an ACL, as a whole, is retrieved, modified locally, and
  1682. then replaced [3]. This approach is simple and reflects the growing
  1683. trend towards get/set type operations.
  1684.  
  1685.  
  1686. It may also be reasonable to extend the "get" and "set"
  1687. concept to apply to default ACLs as well as to the ACL associated
  1688. with an object. This is a natural extension of the way ACLs would
  1689. be manipulated, and default ACL operations may be easily added
  1690. to the recommended system call interface described below,;
  1691.  
  1692.  
  1693. '
  1694.  
  1695.  
  1696. There are also two possible methods for implementing these calls.
  1697. One option is to use separate system calls for each of the ACL
  1698. operations (i.e., getacl, setacl). The other option is to have
  1699. one ACL system call that can be invoked with a number of command
  1700. arguments indicating the desired ACL operation [3]. An example
  1701. of a useful additional command argument is one that would return
  1702. the number of entries in the ACL. This method conserves the number
  1703. of system calls, and provides the flexibility to add ACL commands
  1704. via command arguments. Additionally, using this method, designers
  1705. are free to implement library functions based on the system call
  1706. with particular command flags.  
  1707.  
  1708.  
  1709. For commands, the same issues apply as for system calls. In a
  1710. system with ACLs9 however, there will be a need for commands to
  1711. not only manipulate ACLs. but also to show and manipulate  all
  1712. discretionary  access control  information.  These commands should
  1713. include. at a minimum:
  1714.  
  1715.  •  command(s) to retrieve and set file permission and
  1716. mode bits (Is, chmod)
  1717.  •  command(s) to retrieve and set ACL information (new)
  1718.  •  command(s) to retrieve effective discretionary access
  1719. to files (new)
  1720.  
  1721.  
  1722.  
  1723.  
  1724. In addition, there may be useful features to add to existing utilities
  1725. (e.g., the ability to find a file according to its ACL [12]) so
  1726. that they might be able to conform to the enhanced DAC mechanisms.
  1727. Recommendation
  1728.  
  1729.  
  1730.  
  1731. For the ACL system call interface, get/set ACL type operations
  1732. should be used9 and should be implemented with a unified system
  1733. call with command arguments used to implement the various operations.
  1734. For commands. the names getacl and setacl are recommended since
  1735. they follow from the get/set concept.
  1736. Named ACLs
  1737.  
  1738.  
  1739.  
  1740. A named ACL, as described in A Guide to Understanding Discretionary
  1741. Access Control in Trusted Systems [2], is an ACL that can be shared
  1742. or referred to by name.  They may be implemented in one of two
  1743. ways; either as a template copied into a user's ACL or shared
  1744. through a pointer from the user's ACL space (shared ACL).  A change
  1745. to a shared ACL results in a change to the discretionary access
  1746. on all objects using this ACL. This result may be considered to
  1747. be a side-effect or a desired feature depending on the circumstance.
  1748. Additionally, it may be difficult to determine which objects are
  1749. sharing a specific named ACL, and a user may mistakenly grant
  1750. access to an object that was not intended.  Another problem with
  1751. named ACLs is that as objects they may themselves be required
  1752. to contain discretionary access controls. This suggests the idea
  1753. of recursive ACLs, a situation to be avoided.
  1754. Recommendation
  1755.  
  1756.  
  1757.  
  1758. Named ACLs need not be supported. but a system that does should
  1759. be no less secure or less flexible than one that does not.  Absolute
  1760. Siexibility of ACLs can be achieved, however, through the use
  1761. of default ACLs as discussed in the following section. There is
  1762. no strong case one way or the other for named ACLs. There are
  1763. advantages and disadvantages to both alternatives and it would
  1764. really depend on the environment as to whether named ACLs would
  1765. be of any benefit.
  1766. Default ACLs
  1767.  
  1768.  
  1769.  
  1770. When considering ACLs, an issue arises as to whether a predesignated
  1771. set of ACL entries should be assigned to an object automatically
  1772. at the time of creation. The following alternatives present the
  1773. possible ways to address this issue.
  1774. No Default ACLs
  1775.  
  1776.  
  1777.  
  1778. In this approach, no ACL is assigned at object creation time.
  1779. The process umask will limit the file permission bits, as it currently
  1780. does, to provide some default protection on an object.
  1781.  
  1782.  
  1783. While this alternative maintains compatibility with existing programs,
  1784. it is not a very practical solution. Depending on the relationship
  1785. of the file permission bits and the ACL, the absence of default
  1786. ACLs may not make sense. For instance, in a pure ACL implementation,
  1787. the absence of default ACLs would result in no initial protection
  1788. on newly created files. Additionally, this alternative would not
  1789. encourage the use of ACLs by new programs, and would prevent ACL
  1790. creation by old programs. ACLs could not propagate through the
  1791. system and hence their usability would be lost.
  1792. Require Default ACLs
  1793.  
  1794.  
  1795.  
  1796. In this approach, an ACL would always be assigned at object creation
  1797. time. This would allow for initial finer grained control on an
  1798. object.
  1799.  
  1800.  
  1801. Requiring default ACLs may cause incompatibilities for an old
  1802. program that only looks at the file permission bits when it creates
  1803. an object. Also, for many users, the umask may be a sufficient
  1804. tool for limiting the permissions on an object when it is created.
  1805. The  main advantage of requiring default ACLs is that the usability
  1806. of ACLs is greatly improved. Additionally, since an ACL is associated
  1807. with an object in a single atomic operation, the possibility of
  1808. a temporarily insecure state is avoided.
  1809. Provide Default ACLs
  1810.  
  1811.  
  1812.  
  1813. A mechanism is provided to put default ACLs on new objects. However9
  1814. not all new objects need to have default ACLs. This alternative
  1815. allows specification of a default `ACL, giving a finer granularity
  1816. of access control than that provided by the file permission bits,
  1817. and, at the same time allows, where desired, compatibility with
  1818. existing programs.
  1819. Recommendation
  1820.  
  1821.  
  1822.  
  1823. Providing default ACLs and mechanisms to specify whether or not
  1824. to use them is the best solution. This allows both classes of
  1825. users, those who want default ACLs and those who do not (even
  1826. those who want no ACLs at all), the flexibility to specify the
  1827. scheme that they find most appropriate. Although in many cases
  1828. the process umask would be sufficient to assign default permissions,
  1829. systems and/or users making explicit use of ACLs will desire default
  1830. ACLs. The default ACL scheme used should be straightforward to
  1831. the user and should sensibly interact with the existing DAC mechanisms,
  1832. including the ilmask mechanism. Note that even if an object is
  1833. created with no default ACL, ACL entries may still be added to
  1834. the object.
  1835.  
  1836.  
  1837. This section has really only addressed default ACLs on file system
  1838. objects.  IPC objects are not part of the file system name space,
  1839. and therefore require further consideration.  IPC objects are
  1840.  relatively short lived.  and  are generally  not manipulated
  1841.  by users  at the command level  as are  files.  Based on these
  1842. characteristics default ACLs on IPC objects are probably not needed,
  1843. and their use is not recommended.
  1844. Location Of Default ACLs
  1845.  
  1846.  
  1847.  
  1848. Consider the following possibilities for the origination of the
  1849. default ACL.
  1850. System Wide
  1851.  
  1852.  
  1853.  
  1854. In this approach, one specific default ACL is assigned to any
  1855. object created on the system by any subject. This is a very inflexible
  1856. solution and misses the intent that discretionary access be set
  1857. at the discretion of the user.
  1858. Per Process
  1859.  
  1860.  
  1861.  
  1862. In this approach, each user process defines a default ACL, similar
  1863. to the umask currently used. This is a somewhat restrictive approach
  1864. since this allows the user to set only a single set of defaults
  1865. for all files created. It is likely that a user will wish to associate
  1866. different default ACLs with files created for different projects.
  1867.  Additionally, the default ACL entries would have to be stored
  1868. in the process area. The amount of process space required to hold
  1869. the entries would vary based on the number of entries.
  1870. Per GID Of Created File
  1871.  
  1872.  
  1873.  
  1874. A default ACL could be associated with each GID. If GIDs are viewed
  1875. as project identifiers, the effect is to associate a unique default
  1876. ACL within each project subtree of the file system hierarchy.
  1877. Further, in some UNIX Systems, where GIDs propagate to newly created
  1878. objects based on the GID of the creating directory (rather than
  1879. upon that of the creating subject), default protection very naturally
  1880. distributes across the file system.  However this variant imposes
  1881. a somewhat restrictive viewpoint on the utility of groups.
  1882. Per Directory
  1883.  
  1884.  
  1885.  
  1886. This approach would allow the object's default ACL to originate
  1887. from the containing directory of the object. A directory would
  1888. contain both an ACL to be used for access checking and a default
  1889. ACL to be used when a new object is created in the directory.
  1890. All objects created in the directory would be assigned the default
  1891. ACL.  Newly created subdirectories would inherit the default ACL
  1892. of the parent directory.  In this manner, the default will propagate
  1893. down through the file system structure resulting in much duplication
  1894. of ACLs, possibly using much space. However, the utilization of
  1895. such space is a small price to pay for enhanced security and usability,
  1896. so the default should probably continue to propagate until the
  1897. user takes some explicit action to stop the propagation.
  1898. Recommendation
  1899.  
  1900.  
  1901.  
  1902. A user typically arranges objects per directory representing project
  1903. work or areas of interest. Since it is desirable, then, for similar
  1904. objects to contain the same ACL, the per-directory  approach 
  1905. becomes  the  preferred  mechanism.   Newly-created subdirectories
  1906. should inherit the default ACL of the parent directory, so that
  1907. defaults are propagated down the file system, unless explicitly
  1908. turned off.
  1909. Default ACL Entries At File Creation
  1910.  
  1911.  
  1912.  
  1913. Currently, when a file is created a user can specify its initial
  1914. pe'rmissions, however the access can be further restricted by
  1915. the umask mechanism. The uniask specifies the default protection
  1916. bit settings when a file is created. Any bits set in the umask
  1917. will be cleared in the bit settings on the newly created file.
  1918. It is important, then, to consider how the default permission
  1919. bit settings should interact with the entries in a default ACL.
  1920.  
  1921.  
  1922. Consider the following options in the context of masking the ACL
  1923. entries by the file group class permission bits as recommended
  1924. in the ACL Evaluation section. Also note that these options are
  1925. discussed with respect; to the ACL entry types as described in
  1926. the ACL Entry Type and Format section. Additional mechanisms in
  1927. the ACL which allow direct modification of the file group class
  1928. permission bits at file creation are not precluded.
  1929. OR File Group Class Permission Bits
  1930.  
  1931.  
  1932.  
  1933. Add the default entries to the file and change the file group
  1934. class permission bits to reflect the maximum permissions allowed
  1935. in the ACL. This could result in more permission than was specified
  1936. in the creation call. It is not reasonable to assume that the
  1937. default permission bit settings can be ignored and completely
  1938. overridden by the ACL. For example, if a default entry exists
  1939. for user "fred" with the specified permissions of "rwx"
  1940. but the file is not executable, then this permission should not
  1941. be given.
  1942. AND File Group Class Permission Bits
  1943.  
  1944.  
  1945.  
  1946. Add the default entries to the file but change the permissions
  1947. of the ACL entries so that they are no greater than the file group
  1948. class permission bits.  This is a reasonable alternative, but
  1949. it may present a compatibility problem for some applications.
  1950. An example of this problem would be when a C compiler creates
  1951. a file.  The file would not originally be created with execute
  1952. permission, therefore no ACL entries on the file (which were default
  1953. entries copied from the directory) would have execute permission.
  1954.  The last step for the compiler would be to make the file executable,
  1955. however at this point, execute permission' which may have been
  1956. specified in the default ACL entry is lost.
  1957. No Change To File Group Class Permission Bits
  1958.  
  1959.  
  1960.  
  1961. Add the default entries to the file but do not change the file
  1962. group class permission bits. This may result in ACL entries which
  1963. are restricted by the file group class permission bits.
  1964. Recommendation
  1965.  
  1966.  
  1967.  
  1968. The No Change To File Group Class Permission Bits is recommended
  1969. since it is a reasonable alternative which does not present any
  1970. problems of compatibility for some applications.
  1971. Summary
  1972.  
  1973.  
  1974.  
  1975. This document has provided an analysis of key issues involved
  1976. in extending the discretionary access control in the UNIX system.
  1977. For oach of the issues identified, the paper has suggested alternative
  1978. solutions, discussed the pros and cons of each, and then provided
  1979. a recommendation.
  1980.  
  1981.  
  1982. The following is a review of some of the important recommendations
  1983. presented in the paper. An access control list mechanism was chosen
  1984. to extend the current DAC mechanism. When considering the types
  1985. of access provided in the UNIX system, additional access modes
  1986. need not be defined, however they should also not be precluded.
  1987. The recommended ACL entry type was that of user or group entries.
  1988.  The main advantages of this solution are conformance with the
  1989. UNIX system method of identification through either the user-ID
  1990. or the group-ID, and simplicity for the user. The method in which
  1991. file protection bits and ACLs interact is a very important and
  1992. complex issue given the conflicting goals of security and compatibility.
  1993.  The recommendation of masking the ACL entries by the group field
  1994. of the protection bits was chosen as the most accommodating solution
  1995. considering these goals.  A system defined ordering of the ACL
  1996. entries was preferred and it was recommended that the access allowed
  1997. for a user in multiple groups should be the sum of all access
  1998. allowed for each group represented in the ACL. Considering other
  1999. multiple group issues9 it was recommended to provide the multiple
  2000. concurrent group capability along with some method of subsetting.
  2001.  It was also recommended that default ACLs be provided and that
  2002. they originate from the parent directory of the newly created
  2003. object.
  2004.  
  2005.  
  2006. It is important to note that although these and other specific
  2007. recommendations were given, it is certainly possible to design
  2008. an acceptable class B3, POSIX-compliant UNIX system following
  2009. some of the other alternatives.  In fact, there are issues where
  2010. the recommended solution may not be superior to another alternative
  2011. and the designer should consider his/her own specific requirements
  2012. when making a choice in those areas. It must also be pointed out
  2013. that building a system following all the recommendations presented
  2014. in this paper will not guarantee a full class B3 system.  There
  2015. are many additional class B3 requirements that go beyond the interface
  2016. specification.
  2017. APPENDIX: Worked Example
  2018.  
  2019. Introduction and Overview
  2020.  
  2021.  
  2022.  
  2023. This worked  example  describes  one  particular Implementation
  2024.  following  the recommendations in the TRUSIX rationale.
  2025. Discretionary Access Control
  2026.  
  2027.  
  2028.  
  2029. Discretionary access control (DAC) provides for the controlled
  2030. sharing of objects (e.g., files, IPC objects) between subjects
  2031. (e.g., processes). With discretionary access control,  the owner
  2032. of an object can grant permissions  to other users.  The discretionary
  2033.  access control  mechanism uses object owner, object group,  file
  2034. permission bits (nine permission bits) and the access control
  2035. list (ACL) of an object to determine the discretionary access
  2036. to the object.
  2037.  
  2038.  
  2039. This document will detail the DAC interfaces and their run-time
  2040. behavior.
  2041.  
  2042.  
  2043. The goals of this ACL mechanism were:
  2044.  
  2045.  •  compatibility with the current UNIX System DAC mechanism
  2046. and POSIX
  2047.  
  2048.  
  2049. P1003.1
  2050.  
  2051.  
  2052.  •  user command interfaces that are easy to use and understand
  2053.  •  adhere to the "principle of least astonishment"
  2054.  •  interfaces should continue to work as expected
  2055.  •  chmod 000 file - no access to file
  2056.  •  chmod 700 file - only owner access to file
  2057.  •  chmod 444 file - denies write and execute access to
  2058. file
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066. In addition, intermixing use of the existing and new DAC commands
  2067. should give reasonable results.  For instance chmod should not
  2068. fail due to ACLs, and when chmod x file is executed (x is an octal
  2069. permission) Is -l displays x as the permissions.  The current
  2070. output of Is -l displays the file permission bits as a constant
  2071. width set of nine characters:
  2072.  
  2073.  
  2074. rwxrwxrwx
  2075.  
  2076.  
  2077. However, an ACL, which consists of one or more user entries, one
  2078. or more group entries, one class entry, and one other entry, is
  2079. not a constant length (in the following example,  indicates zero
  2080. or more occurrences of the preceding entry type):
  2081.  
  2082.  • # file: filename
  2083.  • # owner: uid
  2084.  • #group:gid
  2085.  • user::rwx
  2086.  • user:uid:rwx
  2087.  
  2088.  
  2089.  
  2090.  
  2091.    *
  2092.  
  2093.  • group::rwx
  2094.  • group:gid:rwx
  2095.  
  2096.  
  2097.  
  2098.  
  2099.    *
  2100.  
  2101.  • class:rwx
  2102.  • other:rwx
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110. The file permission bits shown by the Is command have the following
  2111. meaning: (note the following "class" definitions are
  2112. from the IEEE POSIX Std 1003.1-1988):
  2113.  
  2114.  • 1. the first 3 bits (high order) represent the file owner
  2115. class and define the permissions for the object owner,
  2116.  • 2. the middle 3 bits (commonly called the group permission
  2117. bits), represent the file group class. This class includes the
  2118. owning group of the file and will be extended to include additional
  2119. user and additional group ACL entries.
  2120.  • 3. the last 3 bits (low order) represent the file other class
  2121. and define the permissions for other (those that did not fall
  2122. into 1 or 2 above).
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. These nine bits indicate the maximum discretionary permissions
  2131. for an object. The actual permissions may always be less than
  2132. indicated. For instance, the permission may indicate write access
  2133. on an object by a specific subject, but the file system may be
  2134. mounted read only. If an ACL mechanism is used these bits will
  2135. continue to indicate the maximum discretionary permissions for
  2136. the object and the ACL may further restrict permissions.
  2137.  
  2138.  
  2139. There is a direct mapping between the ACL and the file permission
  2140.  bits.  Specifically, the file owner class permission bits will
  2141. always be equal to the permissions of the ACL entry for the object
  2142. owner (they may be the same bits depending upon the implementation).
  2143.  Additionally, the file other class permission bits will always
  2144. be equal to the ACL other entry permissions. And the file group
  2145. class permission bits will always be equal to the ACL class entry
  2146. permissions.  Typically, the file group class permission bits
  2147. are set to the maximum permissions allowed to the additional user
  2148. entries, the owning group entry, and the additional group entries.
  2149.  
  2150.  
  2151. Whenever a file is created on a file system that supports ACLs,
  2152. the ACL will contain a user entry for the object owner, a group
  2153. entry for the object owning group, a class entry for the file
  2154. group class permissions, and an other entry for the rest of the
  2155. world. For compatibility with the current mechanism, if the ACL
  2156. contains no additional user or additional group entries, the permissions
  2157. in the group entry for the object owning group and the class entry
  2158. must be the same.
  2159. Use of Access Control Lists
  2160.  
  2161.  
  2162.  
  2163. The use of DAC with ACLs will be explained by comparing it to
  2164. how a user of a non-ACL supporting UNIX System (as currently exists)
  2165. would use DAC. To use the current DAC mechanism a user usually
  2166. first executes Is -l and based on the output decides what the
  2167. permissions must be changed to. in order to allow the desired
  2168. access (for example the user may want to make the file executable,
  2169. or only allow the owner to have write permission).
  2170. EXAMPLE:
  2171.  
  2172.  
  2173.  
  2174. $ ls -l foo
  2175.  
  2176.  •  rw-rw-rw-  1 craig  demo    53 Mar 6 17:37 foo S chmod
  2177. 600 foo $ ls -l foo
  2178.  •  rw             1 craig  demo    53 Mar 617:37 foo
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186. In the new DAC mechanism, using a pure ACL, there will be two
  2187. new commands getacl and setacl (there will be a new function,
  2188. acl, for which these commands provide a user interface). The getacl
  2189. command will be used to display the ACL and the setacl command
  2190. will be used to change the ACL.
  2191.  
  2192.  
  2193. These commands will be used in much the same way that Is and chmod
  2194. are used. A user would first execyte getacl to look at the ACL
  2195. and then use setacl to make the desired changes.  Because the
  2196. ACL is not a fixed size, it may be difficult to manipulate. In
  2197. order to simplify the use of ACLs the following example shows
  2198. how the ACL may be easily manipulated using a text editor to give
  2199. greater flexibility (note that changes may also be specified on
  2200. the setacl command line).
  2201. EXAMPLE:
  2202.  
  2203.  
  2204.  • #the output of getacl is redirected to the file tmp
  2205.  • $ getacl bar > tmp
  2206.  • #the file tmp is edited and the line in italics is inserted
  2207.  • $ vi tmp
  2208.  • # file: bar
  2209.  • # owner: craig
  2210.  • # group: demo
  2211.  • user::rw-
  2212.  • group::rw-
  2213.  • group:guest:r-
  2214.  • class:rw-
  2215.  • other:rw-
  2216.  • #setacl is executed and the contents of the file tmp become
  2217. the new ACL for bar
  2218.  • $ setacl -f tmp bar
  2219.  • #the output from getacl for the file bar is displayed
  2220.  • $ getacl bar
  2221.  • # file: bar
  2222.  • # owner: craig
  2223.  • group: demo
  2224.  • user::rw-
  2225.  • group::rw-
  2226.  • group guest :r-
  2227.  • class:rw-
  2228.  • other:rw-
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234. Structure of Access Control Lists
  2235.  
  2236.  
  2237.  
  2238. The ACL consists of the following types of entries, which must
  2239. be in the following order:
  2240.  
  2241.  • 1. user entry - This type of entry contains a user ID and
  2242. the permissions associated with it. There must always exist one
  2243. entry of th1is type, which will represent the object owner, and
  2244. will be denoted by a null (unspecified) user ID.  There may be
  2245. additional user entries specified; however, no two additional
  2246. user entries will have the same user ID and there may not be any
  2247. additional entries with a null user ID. The term "additional
  2248. user entries" will be used to indicate all user entries except
  2249. the entry for the object owner.
  2250.  • 2. group entry - This type of entry contains a group ID and
  2251. the permissions associated with it. There must always exist one
  2252. entry of this type, which will represent the object owning group,
  2253. and will be denoted by a null (unspecified) group ID. There may
  2254. be additional group entries specified; however. no two additional
  2255. group entries may have the same group ID and there may not be
  2256. any additional entries with a null group ID. The term "additional
  2257. group entries" will be used to indicate all group entries
  2258. except the entry for the object owning group.
  2259.  • 3. class entry - This type of entry contains the maximum permissions
  2260. granted to the file group class. There is exactly one of these
  2261. entries in an ACL.
  2262.  • 4. other entry - This type of entry contains the permissions
  2263. granted to a subject if none of the above entries have been matched.
  2264. There is exactly one of these entries in an ACL.
  2265.  • 5. default entry - This type of entry may only exist on a
  2266. directory. These entries are similar to the entries described
  2267. above, except that they are never used in an access check, but
  2268. are used to indicate the non-default ACL entries that should be
  2269. added to a file created within the directory. Default entries
  2270. are optional9 but no two default entries may have the same type
  2271. and ID.
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279. Within each category the entries must be ordered as follows:
  2280.  
  2281.  
  2282. Entries in the user category shall be sorted numerically by user
  2283. ID from lowest to highest, except for the object owner entry9
  2284. which always precedes all other user entries.
  2285.  
  2286.  
  2287. Entries in the group category shall be sorted numerically by group
  2288. ID from lowest to highest, except for the object owning group
  2289. entry, which always precedes all other group entries.
  2290.  
  2291.  
  2292. Entries in the default:user category shall be sorted numerically
  2293. by user ID from lowest to highest, except for the default object
  2294. owner entry, which always precedes all other default user entries.
  2295. Entries in the default:group category shall be sorted numerically
  2296. by group ID from lowest to highest, except for the default object
  2297. owning group entry, which always precedes all other default group
  2298. entries.  The proper ordering of entries required by the acl function
  2299. can be obtained by the use of the aclsort function. ACL entries
  2300. given as input to the setacl command need not be sorted; the sorting
  2301. will be performed by the setacl command.
  2302.  
  2303.  
  2304. The permissions that may be specified in an ACL entry are read,
  2305. write(w), and execute/search(x).  When the setacl command is executed,
  2306. the file owner class permission bits will be set to the permissions
  2307. specified for the owner and the file other class permission bits
  2308. will be set to the permissions specified for other. As an option,
  2309. the file group class permission bits will be manipulated such
  2310. that they reflect the maximum permission that the ACL permits
  2311. to members of the file group class (any ACL entry other than the
  2312. object owner or other). Otherwise, the file group class permission
  2313. bits will be set to the permissions specified by the class entry.
  2314. Therefore, if the file group class only allows read permission
  2315. then additional user entries and any group entries in the ACL
  2316. will not grant write or execute permission.
  2317.  
  2318.  
  2319. This ACL scheme supports finer discretionary access controls than
  2320. the current mechanism,  while  maintaining  compatibility  with
  2321.  the  current  permissions mechanism.  The DAC information may
  2322. be changed in one atomic operation, avoiding the possibility of
  2323. an intermediate insecure state. Finer controls can be specified
  2324. via the ACL, including explicit specification of users disallowed
  2325. any access to the object. Additionally, the file permission bits
  2326. provide a summary of all access rights.
  2327.  
  2328.  
  2329. Rationale:  The ACL scheme described here will allow entries to
  2330. be either permissive or restrictive. In general, an entry that
  2331. results in less permission than the file other class permissions
  2332. would grant would be considered restrictive. An entry that results
  2333. in more permission than the file other class permissions would
  2334. grant would be considered permissive. In the event that a file
  2335. with an ACL is exported to a non-ACL system, the loss of permissive
  2336. entries would not present a security problem; however, the absence
  2337. of support for restrictive entries may allow a process to have
  2338. permission that it would not have been granted on a system with
  2339. ACLs. This behavior must be described in the documentation.
  2340. Discretionary Access Check Algorithm
  2341.  
  2342.  
  2343.  
  2344. A process may request read, write, or execute/search access permissions
  2345. to a file.  Each access mode is logically checked separately using
  2346. the following algorithm. The process request is granted if all
  2347. individually  requested  modes  are granted.  Otherwise, the access
  2348. request is denied.
  2349.  
  2350.  
  2351. Note, this is a logical description of the access check. The physical
  2352. code sequence may be different for better performance.       
  2353.            
  2354.  
  2355.  
  2356. Discretionary Access Check Algorithm:
  2357.  
  2358.  • I. File Owner Class: If the effective user ID of the process
  2359. matches the user ID of the owner of the file, the process is in
  2360. the file owner class. If the requested access mode bit is set
  2361. in the file owner class permission bits, this access mode is granted.
  2362. Otherwise, access is denied.
  2363.  
  2364.  
  2365.  
  2366.  
  2367. Note, the user ACL entry for the object owner matches the file
  2368. owner class permission bits.
  2369.  
  2370.  • II. File Group Class:  If the process is not in she- file
  2371. owner class and if the effective user ID of the process matches
  2372. the user ID of an additional user ACL entry or the effective group
  2373. ID or any of the supplementary group IDs of the process matches
  2374. the group ID of any group ACL entry9 the process is in the file
  2375. group class. If the process matched an additional user ACL entry,
  2376. only that entry is used as the matching ACL entry; otherwise,
  2377. the matching group ACL entry or entries are used. If the requested
  2378. access mode bit is set in the file group class permission bits
  2379. and is set in a matching ACL entry, this access mode is granted.
  2380. Otherwise, access is denied.
  2381.  • Note, the permissions of the additional user or group ACL
  2382. entries further restrict the access specified by the file group
  2383. class permission bits. Also, the class ACL entry matches the file
  2384. group class permission bits.
  2385.  • III. File Other Class: If the process is not in the file owner
  2386. class or file group class, the process is in the file other class.
  2387. If the requested access mode bit is set in the file other class
  2388. permission bits, this access mode is granted. Otherwise9 access
  2389. is denied.
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  • Note, the other ACL entry matches the file other class permission
  2397. bits.
  2398.  
  2399.  
  2400.  
  2401.  
  2402. The following examples show ACL use and the results of applying
  2403. current and new DAC commands.
  2404. EXAMPLE 1:
  2405.  
  2406.  
  2407.  • $create file foo
  2408.  • $ > foo
  2409.  • #execute ls -l and getacl on the file foo
  2410.  • $ Is -l foo
  2411.  
  2412.  •  rw-r-r--  1 craig  demo       0 Mar 620:27 foo
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  • $ getacl foo
  2422.  • $ file: foo
  2423.  • $ owner: Craig
  2424.  • $ group: demo
  2425.  • user::rw-
  2426.  • group::r-
  2427.  • class:r-
  2428.  • other:r-
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434. EXAMPLE 2:
  2435.  
  2436.  
  2437.  
  2438. #execute getacl and Is -I on the file, run.sh, with added ACL
  2439. entries
  2440.  
  2441.  
  2442. S Is -I run.sh
  2443.  
  2444.  •  rwxr-xr-x+  1 Craig  demo    73 Mar 620:27 run.sh
  2445.  
  2446.  • $ getacl run.sh
  2447.  • # file: run.sh
  2448.  • # owner: Craig
  2449.  • # group: demo
  2450.  • user::rwx
  2451.  • user:fred:r-x
  2452.  • user:larry:--x
  2453.  • group::r-x
  2454.  • group guest:---
  2455.  • class:r-x
  2456.  • other:r-x
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464. EXAMPLE 3:
  2465.  
  2466.  
  2467.  
  2468. #use the chmod command on a file with an ACL
  2469.  
  2470.  
  2471. #use getacl to report both the ACL entries and the effective permissions
  2472.  
  2473.  • $ chmod 644 run.sh
  2474.  • S Is -l run.sh
  2475.  
  2476.  •  rw-r-r--+  1 craig  demo    73 Mar 620:27 run.sh
  2477.  
  2478.  
  2479.  • $ getacl run.sh
  2480.  • # file: run.sh
  2481.  • # owner: craig
  2482.  • #group: demo
  2483.  • user::rw-
  2484.  
  2485.  
  2486.  
  2487.  
  2488. user:fred:r-x     #effective:r-
  2489.  
  2490.  
  2491. user:larry:--x    #effective:---
  2492.  
  2493.  
  2494. group::r-x        #effective:r-
  2495.  
  2496.  • group guest:---
  2497.  • class:r- -
  2498.  • other:r-
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504. File Object Creation
  2505.  
  2506.  
  2507.  
  2508. When a new object (regular files, special files, directories,
  2509. named pipes) is created in
  2510.  
  2511.  
  2512. the file system, there are several important attributes that must
  2513. be initialized. These are the user ID of the owner of the file,
  2514. the group ID associated with the file, the file permission bits,
  2515. and the ACL.
  2516.  
  2517.  
  2518. The user ID of the file is set to the effective user ID of the
  2519. invoking process. The group ID of the file depends upon the mode
  2520. of the containing directory. If the S_ISGID bit is not set on
  2521. the directory, the group ID of the file is set to the effective
  2522. group ID of the invoking process. If the S_ISGID bit is set on
  2523. the directory, the group ID of the file is set to the group ID
  2524. of the containing directory.
  2525.  
  2526.  
  2527. Each function that creates a new file supplies an initial value
  2528. for the file permission bits. This initial value is then merged
  2529. with the file mode creation mask (umask) of the invoking process
  2530. and with any default ACL entries of the containing directory to
  2531. form the file permission bits and ACL of the new file.
  2532.  
  2533.  
  2534. Although in many cases the process umask is sufficient to assign
  2535. default permissions, users making explicit use of ACLs may desire
  2536. default ACLs. The default ACL scheme must sensibly interact with
  2537. the existing DAC mechanism, including umask.  The default ACL
  2538. entries specify permissions for users and/or groups and/or others,
  2539. that will be assigned to a new file. These default ACL entries
  2540. are associated with a directory. Note, an ACL on a directory may
  2541. contain entries that control access to the directory and entries
  2542. (defaults) used for new file creation in that directory.
  2543.  
  2544.  
  2545. The process of creating the file permission bits and the ACL for
  2546. the new file is called "ACL Merge". First, any mode
  2547. parameter is transformed into the equivalent ACL form.  For example,
  2548. the mode 0664 is equivalent to user::rw-, group::rw-, class:rw-,
  2549. other:r--.  Also, the complement of the umask is used to obtain
  2550. the equivalent ACL. Thus, the umask 022 is equivalent to user::rwx,
  2551. group::r-x, class:r-x, other:r-x.
  2552.  
  2553.  
  2554. Two ACLs are merged by first logically sorting both ACLs into
  2555. one ACL. Then any pair of matching entries are replaced with an
  2556. entry that has permissions formed by ANDing the matched entries.
  2557. Thus a permission is in the merged entry only if it was previously
  2558. in both entries.
  2559.  
  2560.  
  2561. The first ACL merge is with the initial mode from the file creation
  2562. function and with the process file mode creation mask. The second
  2563. ACL merge is with any default entries from the containing directory.
  2564. The result is the ACL for the new file. The file permission bits
  2565. are then set from the user, class, and other ACL entries.  Note,
  2566. this may be different from the setacl command with the -r option
  2567. since this merge does not set the file group class permission
  2568. bits to the maximum permission of the file group class entries.
  2569.  
  2570.  
  2571.  
  2572. Finally, if the new object is a directory, then any default entries
  2573. from the containing directory are copied to the new ACL. That
  2574. is, the default ACL entries of the new directory are the same
  2575. as the default ACL entries of the containing directory.
  2576.  
  2577.  
  2578. An example of the ACL merge operation is shown in the following
  2579. figure:
  2580.  
  2581.  
  2582. 000666::rw
  2583.  
  2584.  
  2585. user::rw-
  2586.  
  2587.  
  2588. creat("file", 0666) .. . .. .  group::rw-
  2589.  
  2590.  • class:rw-
  2591.  • other:rw-      ACL Merge
  2592.  
  2593.  
  2594.  
  2595.  
  2596. Operation
  2597.  
  2598.  
  2599.    umask 002    user::rwx    
  2600.  
  2601.  
  2602.   group::rwx
  2603.  
  2604.  
  2605.   class:rwx
  2606.  
  2607.  
  2608.   other:r-w
  2609.  
  2610.  • 0664
  2611.  • user::rw-
  2612.  • group::rw-
  2613.  • class :rw-
  2614.  
  2615.  • other:r-
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625. Directory  ....  user:gamma:r--  
  2626.  
  2627.  
  2628. default ACL        group::r-
  2629.  
  2630.  
  2631. entries  .. .. . group:alpha:rw-
  2632.  
  2633.  
  2634.       qroup:beta:---         0664
  2635.  
  2636.  
  2637.          user::rw-
  2638.  
  2639.  
  2640.          user:gamma:r-
  2641.  
  2642.  • group::r-
  2643.  • group:alpha:rw-
  2644.  • group:beta:---
  2645.  • class:rw-
  2646.  • other:r-
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652. IPC Object Creation
  2653.  
  2654.  
  2655.  
  2656. When  an IPC  object  is created  (by shmget for shared memory,
  2657. by semget for semaphores, by msgget for messages), its cuid and
  2658. uid will be set equal to the effective user ID of the invoking
  2659. process and its cgid and gid will be set equal to the effective
  2660. group ID of the invoking process. The initial permissions are
  2661. set equal to the specified permissions in the flag argument to
  2662. the *get calls (shmflg, semflg, and msgflg, respectively). Note
  2663. that default ACLs do not apply to IPC~' objects, although ACLs
  2664. may be added explicitly to an IPC object via the acllpc call.
  2665. Compatibility Requirements
  2666.  
  2667.  
  2668.  
  2669. A user will generally use the current DAC commands (Is and chmod)
  2670. or the new DAC commands (getacl and setacl). However, the use
  2671. of these commands are likely to still be inter-mixed, and they
  2672. must all give correct information.
  2673.  
  2674.  
  2675. The entire interface to the current discretionary access control
  2676. information must continue to function as it currently does. For
  2677. example, chmod must still be able to modify the file permission
  2678. bits and Is must still be able to report them.
  2679.  
  2680.  
  2681. Note that although Is will still report these permissions. they
  2682. will not be the only permissions evaluated during an access check.
  2683. The output of Is will continue to be the maximum permission that
  2684. may be granted, but there may be additional discretionary access
  2685. control information (ACL entries) that was added to the object.
  2686.  In order to indicate that additional entries exist, Is-I will
  2687. display the character "+" to the right of the current
  2688. permissions display if an ACL is present. Therefore, when additional
  2689. discretionary access control information has been added, in the
  2690. form of ACL entries (as shown in the examples on previous pages),
  2691. a user will need to use the newly provided command, getacl, to
  2692. get a full view of the current discretionary access controls in
  2693. effect. Although chmod will still modify the file permission bits,
  2694. it will not change any additional discretionary  access control
  2695. information (i .e., ACL entries for additional users and additional
  2696. groups) added to the object. To change these additional entries
  2697. if they exist, the user will need to use the setacl command.
  2698.  
  2699.  
  2700. When the owner of an object is changed, the result will be identical
  2701. to the current behavior. If the owner is changed to a user ID
  2702. for which an additional user entry already exists in the ACL,
  2703. the additional user entry is not changed but the user entry for
  2704. the object owner will take precedence during an access check.
  2705. When the group of an object is changed. the result will be identical
  2706. to the current behavior. If the group is changed to a group ID
  2707. for which an additional group entry already exists in the ACL,
  2708. the additional group entry is not changed but the group entry
  2709. for the object owning group will take precedence during an access
  2710. check (except in the case of multiple concurrent groups, where
  2711. all group entries are given equal treatment).
  2712.  
  2713.  
  2714. When the ACL contains no additional  user or additional  group
  2715. entries, the permissions in the group entry for the object owning
  2716. group and in the class entry must be the same. This behavior is
  2717. the same as the current mechanism since the file permission bits
  2718. can only specify at most three different permissions.
  2719. Documentation Requirements
  2720.  
  2721.  
  2722.  
  2723. The ACL mechanism and its proper use must be fully described in
  2724. the Trusted Facility Manual and manual pages must be created for
  2725. the Security Features User's Guide and Security Features Programmer's
  2726. Guide for all new commands and functions.
  2727. Commands and Functions
  2728.  
  2729. setacl Command
  2730.  
  2731.  
  2732.  
  2733. DESCRIPION:     The setacl command will support the changing of
  2734. discretionary
  2735.  
  2736.  
  2737. permission information associated with a file. It will allow the
  2738. file owner or a process with appropriate permission or appropriate
  2739. privilege to perform the following functions:
  2740.  
  2741.  • 1. replace an entire ACL, including the default ACL entries
  2742. on a directory,
  2743.  • 2. add, change, or delete an ACL or default ACL entry or entries.
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751. This command gives the user an interface to a pure ACL mechanism,
  2752. allowing a finer granularity for file access.
  2753.  
  2754.  
  2755. Note that this command only supports the file system objects:
  2756. e.g., regular files, special files, directories, and named pipes.
  2757. For simplicity, these objects are referred to as "files".
  2758. SYNOPSIS:
  2759.  
  2760.  
  2761.  
  2762. setacl [-r] [ -rn (u[ser]::operm Jperm[,]]
  2763.  
  2764.  • [rn[ser]:uid:operm  perm[,...]]
  2765.  • [g[roup]::operm perm[9]]
  2766.  • [g[roup]:gid:operm  perm[,...]]
  2767.  • [c[lass]:operm perm[,]]
  2768.  • [o[ther]:operm perm[,]]
  2769.  • [d[efault]:u[ser]::operm perm]
  2770.  • [d[efault]:u[ser]:uid:operm perm[....]]
  2771.  • [d[efault]:g[roup]::operm perm]
  2772.  • [d[efault]:g[roup]:gid:operm  perm[....]]
  2773.  • [d[efault]:c[lass]:operm  perm]
  2774.  • [d[efault]:o[ther]:operm  perm]
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  •  d [u[ser]:uid[,...]][g[roup]:gid[,...]] [d [efault]:u[ser]:[,...]]
  2782.  
  2783.  • [d[efault]:u[ser]:uid[,...]] [d[efault]:g[roup]:[,...]]
  2784.  • [d[efault]:g[roup]:gid[,...]] [d[efault]:c[lass]:[,...]]
  2785.  • [d[efault]:o[ther]:[,...]]]
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792. file
  2793.  
  2794.  
  2795. or
  2796.  
  2797.  
  2798. setacl [-r] -s u[ser]::operm perm[,]
  2799.  
  2800.  • [u[ser]:uid:operm  perm[,...]]
  2801.  • g[roup]::operm perm[,]
  2802.  • [g[roup]:gid:operm  perm[,...]]
  2803.  • c [lass]:operm perm [,]
  2804.  • o[ther]:operm perm[,]
  2805.  • [d[efault]:u[ser]::operm  perm]
  2806.  • [dl[ef&Wt]:u[ser]:uid:operm  perm[,...]]
  2807.  • [d[efault]:g[roup]::operm  perm]
  2808.  • [d[efault]:g[roup]:gid:operm  perm[,...]]
  2809.  • [d[efault]:c[lass]:operm  perm]
  2810.  • [d[efault]:o[ther]:operm  perm]
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818. file...
  2819.  
  2820.  
  2821. or
  2822.  
  2823.  
  2824. setacl [-r] -f acljile file
  2825.  
  2826.  
  2827. where:
  2828.  
  2829.  
  2830. operm = octal representation of permissions
  2831.  
  2832.  
  2833. (Note: for an ACL entry one octal digit is required)
  2834.  
  2835.  
  2836. perm = a permissions string composed of the
  2837.  
  2838.  
  2839. characters r (read). w (write), x (execute/search), or - (no permission).
  2840. The permission string must be at least 1 character and no more
  2841. than 3 characters.  The characters r. w, and x may only be in
  2842. the string at most once. The characters may be in any order within
  2843. the string.
  2844.  
  2845.  
  2846. uid = user identity (i.e., login name or user ID) gid = group
  2847. identity (i.e., group name or group ID)
  2848.  
  2849.  
  2850. When the -f option is specified, it will take the access control
  2851. information stored in the file acljile and assign it to the file
  2852. file. See the PROCESSING section below for further information
  2853. on the format of the file acljile.
  2854.  
  2855.  
  2856. PROCESSING:    A unique ACL will exist for each file on the system.
  2857. There are four
  2858.  
  2859.  
  2860. types of ACL entries, consisting of user, group, class, and other.
  2861. The user entry for the file owner, the group entry for the file
  2862. owning group, the class entry for the file group class, and the
  2863. entry for other must always be in the ACL.
  2864.  
  2865.  • 1. user entry - This type of entry contains a user ID and
  2866. the associated permissions that will be granted to the user. There
  2867. must always exist one entry of this type, which will represent
  2868. the file owner, and will be denoted by a null (unspecified) user
  2869. ID. There may be additional user entries specified; however each
  2870. entry must specify a unique user ID and there may not be any additional
  2871. entries with a null user ID. If there is a user entry with a user
  2872. ID equal to the file owner the file owner entry will take precedence
  2873. when an access check is performed.
  2874.  • 2. group entry - This type of entry contains a group ID and
  2875. the associated permissions that will be granted to the group.
  2876. There must always exist one entry of this type, which will represent
  2877. the file owning group, and will be denoted by a null (unspecified)
  2878. group ID.  There may be additional group entries specified; however,
  2879. each entry must have a unique group ID and there may not be any
  2880. additional entries with a null group ID.
  2881.  • 3. class entry - This type of entry contains the maximum permissions
  2882. for the file group class. There is exactly one of these entries
  2883. in an ACL.
  2884.  • 4. other entry - This type of entry contains the permissions
  2885. granted to a subject if none of the above entries have been matched.
  2886. There is exactly one of these entries in an ACL.
  2887.  
  2888.  
  2889.  
  2890.  
  2891. When the setacl command is used to change the ACL. it may result
  2892. in changes to the file permission bits. Specifically. when the
  2893. user ACL entry for the file owner is modified the file owner class
  2894. permission bits will be modified. When the class ACL entry is
  2895. modified, the file group class permission bits will be modified.
  2896.  When the other ACL entry is modified the file other class permission
  2897. bits will be modified.
  2898.  
  2899.  
  2900. When the additional user entries or additional group entries of
  2901. the ACL are modified, the file group class permission bits may
  2902. also need to be modified to reflect the maximum permission allowed
  2903. by these entries.
  2904.  
  2905.  
  2906. The -r, recalculate, option will result in the permissions specified
  2907. in the class entry being ignored and replaced by the maximum permission
  2908. needed for the file group class.  For example, if there are no
  2909. additional user entries or additional group entries, the permission
  2910. of the group entry for the file owning group is used for the class
  2911. entry.
  2912.  
  2913.  
  2914. A directory may contain default ACL entries. These entries may
  2915. be of the type  default:user.  default:group,  default:class,
  2916.  or  default:other.   For default:user entries, if no user ID
  2917. is specified, this entry will apply to the file owner permissions.
  2918.  Additional default:user entries must have a unique user ID specified.
  2919. For default:group entries, if no group ID is specified, this entry
  2920. will apply to the file owning group permissions.  Additional default:group
  2921. entries must have a unique group ID specified.  If there are no
  2922. additional default:user entries or additional default:group entries,
  2923. then the permissions of the default group and the default class
  2924. must be the same.
  2925.  
  2926.  
  2927. If a file is created in a directory which contains default ACL
  2928. entries the entries will be added to the newly created file. 
  2929. Note that the default permissions specified for the file owner
  2930. class, file group class, and file other class will be constrained
  2931. by the umask and the mode( specified in the file creation call.
  2932. If default ACL entries are specified for a file which is not a
  2933. directory the command will fail (11), see ERRORS AND RETURNS.
  2934.  
  2935.  
  2936. With no options and arguments (1), see ERRORS AND RETURNS. If
  2937. the MAC or DAC check fails when a request is made to modify the
  2938. ACL (2), see ERRORS AND RETURNS. If the file named file does not
  2939. exist (6), see ERRORS AND RETURNS.
  2940.  
  2941.  
  2942. If options are specified, the validity of the option-arguments
  2943. will be checked.  If an invalid option is specified (3a), see
  2944. ERRORS AND RETURNS.  The arguments must be processed in the order
  2945. specified (e.g., if the modify option is specified with a user,
  2946. followed by the delete option with ihe same user, the entry will
  2947. be deleted).
  2948.  
  2949.  
  2950. For the -m. -s, and -d options, if uid is not a valid login name
  2951. or a valid user ID (3b), or if gid is not a valid group name or
  2952. a valid group ID (3c), or if a specified perrn is not r. w. x,
  2953. -, or a specified operm is not an octal digit (3d), see ERRORS
  2954. AND RETURNS.
  2955.  
  2956.  
  2957. The -m option is used to add a new ACL entry or change an existing
  2958. ACL entry.
  2959.  
  2960.  
  2961. If an entry already exists for the specified uid or gid. the specified
  2962. permissions (perm operm) will replace the current permissions.
  2963. If an entry does not exist for the specified uid or gid, an entry
  2964. will be created. Note that an entry with no permissions will result
  2965. in the specified uid or gid being denied access (any permissions)
  2966. to the file. To specify no access in an entry being modified or
  2967. added, either 0 should be specified for operm or - should be specified
  2968. for perm.
  2969.  
  2970.  
  2971. The -s option is used to replace the ACL information on a file.
  2972. The effect of using this option is that all entries are removed,
  2973. and replaced by the newly specified ACL. If -s is specified with
  2974. -d, -f, or -m (ST, see ERRORS AND RETURNS. There must be exactly
  2975. one user entry specified for the file owner, exactly one group
  2976. entry specified for the file owning group, exactly one class entry
  2977. specified for the file group class, and exactly one other entry
  2978. specified.  If there is no user entry specified for the file owner.
  2979. or no group entry specified for the file owning group9 or no class
  2980. entry specified for the file group class, or no other entry specified
  2981. (8), see ERRORS AND RETURNS.  There may be additional user ACL
  2982. entries and additional group ACL entries specified. If duplicate
  2983. entries are specified (9), see ERRORS AND RETURNS.
  2984.  
  2985.  
  2986. The -d option is used to delete an existing entry from the ACL.
  2987. If a matching entry is not found (4a), see ERRORS AND RETURNS.
  2988. Othdrwise, the matching entry will be deleted. The user entry
  2989. for the file owner, the group entry for the file owning group,
  2990. the class entry, and the other entry may not be deleted from the
  2991. ACL. If an attempt is made to delete one of these entries (4b),
  2992. see ERRORS AND RETURNS.
  2993.  
  2994.  
  2995. (Note: deleting an entry may have different effects than removing
  2996. all the specified permissions for an entry. If an entry is deleted
  2997. and a search is later done for the user or group identity that
  2998. appeared in the entry, this identity might match another entry
  2999. and then be given the permissions specified in this other entry.
  3000. If the original entry remained with no permissions and a search
  3001. was done for this identity. the search might match this entry
  3002. and the subject would be denied access.)
  3003.  
  3004.  
  3005. The -f option is used to assign the ACL information contained
  3006. in the file named acljile to the specified file(s). If -f is specified
  3007. with -d. -s. or -m (5), see ERRORS AND RETURNS. If the file named
  3008. acljile does not exist (6), see ERRORS AND RETURNS.  The file
  3009. named acljile must be readable by the invoking subject. If it
  3010. is not readable (2), see ERRORS AND RETURNS.  If the entire file
  3011. named aclJile contains correct external representation(s) for
  3012. ACL entries, the ACL for the specified file(s) will be (removed
  3013. and) replaced with the ACL whose external representation is contained
  3014. in the file named acljile. Each external representation of an
  3015. ACL entry, contained in the file named acljile, must be on a separate
  3016. line and must be in the following format:
  3017.  
  3018.  • u[ser]::operm perm
  3019.  • [u[ser]:uid:operm perm]
  3020.  • g[roup]::operm perm
  3021.  • [g[roup]:gid:operm perm]
  3022.  • c[lass]:operm perm
  3023.  • o[ther]:operm perm
  3024.  • [d[efault]:u[ser]::operm perm]
  3025.  • [d[efault]:u[ser]:uid:operm  perm[,...]]
  3026.  • [d[efault]:g[roup]::operm  perm]
  3027.  • [d[efault]:g[roup]:gid:operm  perm[,...]]
  3028.  • [d[efarnlt]:c[lass]:operm  perm]
  3029.  • [d[efault]:o[ther]:operm perm]
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037. The entries are not required to be in any specific order within
  3038. the file.  There must be exactly one user entry specified for
  3039. the file owner, exactly one group entry specified for the file
  3040. owning group, exactly one class entry specified for the file group
  3041. class, and exactly one other entry specified. If not, see ERRORS
  3042. AND RETURNS. There may be additional user ACL entries and additional
  3043. group ACL entries specified. If duplicate entries are specified
  3044. (9), see ERRORS AND RETURNS.`  Validity checks are performed 
  3045. on all entries.  If an invalid  entry isencountered (7); see ERRORS
  3046. AND RETURNS.  If the exact problem can bedetermined an additional
  3047. message may be displayed (3b)(3c)(3d), see ERRORS
  3048. AND RETURNS.
  3049.  
  3050.  
  3051.  
  3052. The character "#" will be used to indicate a comment.
  3053. All characters starting with the #. to the end of the line will
  3054. be ignored. Note that this includes any effective permissions
  3055. (#effective:rwx) displayed by getacl.  This command may be executed
  3056. on a file system that does not support ACLs.  If ACL entries are
  3057. specified which do not map into the base permissions (10), see
  3058. ERRORS AND RETURNS, otherwise the base permissions will be set.
  3059.  
  3060.  
  3061. ERRORS AND RETURNS:  Following  is  a  list  of  error  conditions
  3062.  and  the
  3063.  
  3064.  
  3065. corresponding error message that should be output when this condition
  3066. occurs.
  3067.  
  3068.  
  3069. usage: setacl [-r] [ -m [rn(ser]::operm perm[.]]
  3070.  
  3071.  • [rn[ser]:uid:operm perm[,...J]
  3072.  • [g[roup]::operm perm[9]]
  3073.  • [g(roup]:gid:operm perm[....]]
  3074.  • [c[Iass]:operm perm[]]
  3075.  • [o[ther]:operm perm[,]]
  3076.  • [d(efault]:u[ser]::operm perm]
  3077.  • (d(efarnlt]:u[ser]:uid:operm  perm(9...]]
  3078.  • [d[efault]:g[roup]::operm  perm]
  3079.  • [d[efault]:g[roup]:gid:operm  perm[,...]]
  3080.  • [d[efault]:c[lass]:operm perm]
  3081.  • [d[efault]:o[ther]:operm perm]
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  •  d [rn[ser]:uid(,...]][g[roup]:gid(,...]] [d [eault]:u(ser]:]
  3089. fd [efault]:u[ser]:uid[,...]] [d[efault]:g[roupj:[,...]]
  3090.  
  3091.  
  3092.  
  3093.  • [d[efault]:g(roup]:gid] [d[efarnlt]:o[ther]:]]
  3094.  
  3095.  
  3096.  
  3097.  
  3098. file...
  3099.  
  3100.  
  3101. or
  3102.  
  3103.  
  3104. setacl [-r] -s rn(ser]::operm perm[,]
  3105.  
  3106.  • [rn[ser']:uid:operm perm[,...]]
  3107.  • g[roup]::operm perm(.]
  3108.  • [g[roup]:gid:operm perm[,...]]
  3109.  • c[lass]:operm perm[,]
  3110.  • o[ther]:operm perm[,]
  3111.  • [d[efault]:u[ser]::operm  perm]
  3112.  • [d[efault]:u[ser]:uid:operm  perm[9...]]
  3113.  • [d[efault]:g[roup]::operm  perm]
  3114.  • [d[efault]:g[roup]:gid:operm  perm[....]]
  3115.  • [d[efault]:c[lass]:operm  perm]
  3116.  • [d[efault]:o[ther]:operm \perm]
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124. file
  3125.  
  3126.  
  3127. or
  3128.  
  3129.  
  3130. setacl [-r] -f acljile file
  3131. (1) No options or arguments:
  3132.  
  3133.  
  3134.  • UX:setacl: ERROR: incorrect usage
  3135.  • usage:...
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141. (2) If MAC or DAC check fails on the specified file:
  3142.  
  3143.  
  3144.  
  3145. UX:setacl: ERROR: permission denied for `jilename"
  3146. (3) invalid option-arguments:
  3147.  
  3148.  
  3149.  • (a) incorrect/unknown option specified:
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  • UX:setacl: ERROR: illegal option-"-option"
  3157.  
  3158.  • usage:
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  • (b) invalid user ID:
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170. UX:setacl: ERROR: unknown user-id "uid"
  3171.  
  3172.  
  3173.  • (c) invalid group ID:
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  • UX:setacl: ERROR: unknown group-id "gid" (dJ  invalid
  3181. permission:
  3182.  
  3183.  
  3184.  
  3185.  
  3186. UX:setacl: ERROR: unknown permission "permission"
  3187.  
  3188.  
  3189. usage:...
  3190. (4) invalid attempt to delete an ACL entry:
  3191.  
  3192.  
  3193.  • (a) attempt to delete a non-existent entry from an ACL:
  3194.  • UX:setacl: ERROR: matching entry not found in ACL
  3195.  • (b) attempt to delete file owner, file owning group. class.
  3196. or other
  3197.  • ACL entries:
  3198.  • UX:setacl: ERROR: file owner, file group, "class".
  3199. and "other" entries
  3200.  • may not be deleted
  3201.  
  3202.  
  3203. (5) the options specified are mutually exclusive:
  3204.  
  3205.  
  3206.  
  3207. UX:setacl: ERROR: incompatible options specified
  3208.  
  3209.  
  3210. usage:
  3211. (6) filename does not exist:
  3212.  
  3213. UX:setacl: ERROR: file `jile,name" not found
  3214.  
  3215. (7) an invalid ACL entry encountered in the file acljile:
  3216.  
  3217.  
  3218. UX:setacl: ERROR: "acljile", line line; invalid
  3219. ACL entry
  3220.  
  3221. (8) required entry for file owner, file owning group, class,
  3222. or other missing:
  3223.  
  3224.  
  3225.  
  3226. UX:setacl: ERROR: required entry for file owner, file group, "class",
  3227. or "other" not specified usage:
  3228. (9) duplicate ACL entries specified:
  3229.  
  3230.  
  3231.  
  3232. UX:setacl: ERROR: duplicate entries: "acl,entry"
  3233. (10) the file system does not have ACLs, and additional entries
  3234. are specified:
  3235.  
  3236.  
  3237.  
  3238. UX:setacl: ERROR: only file owner, file group, "class"
  3239. or "other"
  3240.  
  3241.  
  3242. entries may be specified
  3243. (11) the specified file is not a directory, and default e('ntries
  3244. have been specified:
  3245.  
  3246.  
  3247.  
  3248. UX:setacl: ERROR: default ACL entries may only be set on directories
  3249.  
  3250.  
  3251. OUTPIIT:  None
  3252. getacl Command
  3253.  
  3254.  
  3255.  
  3256. DEsCRII'TION:   The getacl command will support (he displaying
  3257. of discretionary
  3258.  
  3259.  
  3260. information associated with a file. It will allow the file owner
  3261. or a process with appropriate permission or appropriate privilege
  3262. to perform the following functions:
  3263.  
  3264.  • 1. display the owner, group, and ACL for the specified file(s),
  3265.  • 2. display the default ACL for a directory.
  3266.  
  3267.  
  3268.  
  3269.  
  3270. Note that this command only supports the file system objects:
  3271. e.g., regular files, special files, directories. and named pipes.
  3272. For simplicity, these objects are referred to as "files".
  3273. SYNOPSIS:
  3274.  
  3275.  
  3276.  
  3277. getacl [-ad] file
  3278.  
  3279.  
  3280. PROCESSING:    With no arguments (1), see ERRORS AND RETURNS.
  3281.  If MAC or
  3282.  
  3283.  
  3284. DAC check fails when a request is made to display the ACL information
  3285. (2), see ERRORS AND RETU'RNS.  With invalid options (3), see ERRORS
  3286. AND RETURNS.  If the file named file does not exist (4), see ERRORS
  3287. AND REtuRNS.
  3288.  
  3289.  
  3290. With the -a option specified, the filename, owner, group, and
  3291. the ACL of the file will be displayed.  With the -d option specified,
  3292. the filename, owner, group, and the default ACL of the file will
  3293. be displayed, if it exists. If the specified file does not support
  3294. default ACLs (e.g., it is not a directory) only the filename,
  3295. owner, and group will be displayed. With no option specified,
  3296. both the ACL and the default ACL (if it exists) of the file will
  3297. be displayed.  This command may be executed on a file system that
  3298. does not support ACLs.
  3299.  
  3300.  
  3301. It will report the ACL based on the base permission bits.
  3302.  
  3303.  
  3304. ERRORS AND RETURNS:  Following  is  a  list  of  error  conditions
  3305.  and  the
  3306.  
  3307.  
  3308. corresponding error message that should be output when [his condition
  3309. occurs.
  3310.  
  3311.  
  3312. usage: getacl [-ad] file
  3313. (1) No arguments:
  3314.  
  3315.  
  3316.  • UX:getacl: ERROR: incorrect usage
  3317.  • usage:...
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323. (2) If MAC or DAC check fails when a request is made to display
  3324. the ACL information:
  3325.  
  3326.  
  3327.  
  3328. UX:getacl: ERROR: permission denied for `file" - (3)  incorrect/unknown
  3329. option specified:
  3330.  
  3331.  • UX:getacl: ERROR: illegal option-"-optio,t"
  3332.  
  3333.  • usage:...
  3334.  
  3335.  
  3336.  
  3337.  
  3338. (4) file does not exist:
  3339.  
  3340. UX:setacl: ERROR: file `file" not found
  3341.  
  3342.  
  3343.  
  3344. OUTPUT:    When an ACL is displayed, the external representation
  3345. of the ACL will
  3346.  
  3347.  • be as follows:
  3348.  • # file: filename
  3349.  • # owner: uid
  3350.  • # group: gid
  3351.  • user::perm
  3352.  • inser:uid:perm
  3353.  • group::perm
  3354.  • group:gid:perm
  3355.  • class:perm
  3356.  • other:perm
  3357.  • default :user: :perm
  3358.  • default :user:uid:perm
  3359.  • defai,lt :group: :perm
  3360.  • default :group :gid :perm
  3361.  • default :class :perm
  3362.  • default :other :perm
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370. The ACL entries will be displayed in the order listed above (the
  3371. user entry for the file owner, followed by zero or more additional
  3372. user entries, followed by the group entry [or the file owning
  3373. group, followed by zero or more additional group entries, followed
  3374. by the class entry for the file group class, followed by the entry
  3375. for other).  When the specified file is a directory the entries
  3376. described above may be followed by default entries (the default
  3377. user entry for the file owner, followed by zero or more additional
  3378. d~efault:user entries, followed by the default:group entry for
  3379. the file owning group, followed by zero or more additional defarnlt:group
  3380. entries, followed by the default:class entry for the file group
  3381. class, followed by the entry for default:other). Note that these
  3382. default ACL entries are never used in an access check.  If more
  3383. than one file is specified, a blank line will be displayed before
  3384. the ACL of the next file is displayed.
  3385.  
  3386.  
  3387. The first line displays the name of the file, next the file owner,
  3388. and then the file owning group. The user entry without a user
  3389. ID indicates the permissions -that will be granted to the owner
  3390. of the file. The additional user entries indicate the permissions
  3391. that will be granted to the specified user. The group entry without
  3392. a group indicates the permissions that will be granted to the
  3393. group of the file. The additional group entries indicate the permissions
  3394. that will be granted to the specified group.  The class entry
  3395. indicates the permissions that will be granted to the file group
  3396. class. The other entry indicates the permissions that will be
  3397. granted to others.
  3398.  
  3399.  
  3400. The  default  entries  (default user,   default group,   default:class,
  3401.   and default:other) may only exist for directories, and indicate
  3402. the default user, group, class, and other entries respectively
  3403. that will be merged with the ACL for a new file created within
  3404. the directory.
  3405.  
  3406.  
  3407. The uid is a login name, or a user ID (only if there is no login
  3408. name associated with the user ID); gid is a group name. or a group
  3409. ID (only if there is no group name associated with the group ID);
  3410. and perm is a three character string composed of the  letters
  3411. representing  the separate discretionary  access controls, r (read).
  3412. w (write), x (execute/search), or the character -. The perm will
  3413. be displayed in the following order: rwx. If a permission is not
  3414. granted by this ACL entry. the placeholder. "-", will
  3415. appear. For example. if the user does not have write permission.
  3416. but does have read and execute permission, r-x will be output.
  3417.  
  3418.  
  3419. The file group class permission bits constrain the ACL (represent
  3420. the most access that any entry in the ACL may have). If a user
  3421. executes the chmod command and changes the file group class permission
  3422. bits this may change the permissions that would be granted based
  3423. on the ACL alone. This behavior is necessary for the save-restore
  3424. model (all permissions are temporarily removed via chmod 000 file
  3425. and then restored) to work correctly. In order to indicate that
  3426. the file permission bits are more restrictive than an ACL entry,
  3427. getacl will display the ACL entry as described above with an additional
  3428. tab followed by a sharp sign and the effective permissions.
  3429.  
  3430.  
  3431. Note that output from getacl will be in the correct format for
  3432. input to setacl.  Therefore, if the output is redirected into
  3433. a file (e.g., getacl junk > entries), this file can be used
  3434. as input to setacl (e.g., setacl -f entries junk.new). In this
  3435. way, a user can easily assign one file's ACL information to another
  3436. file.
  3437. EXAMPLES:
  3438.  
  3439. 1) File with several ACL entries:
  3440.  
  3441.  
  3442.  • #file:fred
  3443.  • #owner:craig
  3444.  • # group: demo
  3445.  • user::rwx
  3446.  • user:spy:---
  3447.  • user:larry:rw-
  3448.  • group::r-
  3449.  • class:rw-
  3450.  • other:---
  3451.  
  3452.  
  3453. 2) Same file. after a "chmod 700 fred":
  3454.  
  3455.  
  3456.  • #file:fred
  3457.  • $ owner: craig
  3458.  • $ group: demo
  3459.  • user::rwx
  3460.  • user:spy:---
  3461.  
  3462.  
  3463.  
  3464.  
  3465. user:larry:rw-     #effective:---
  3466.  
  3467.  
  3468. group::r--        $effective:---
  3469.  
  3470.  • class:---
  3471.  • other:---
  3472.  
  3473.  
  3474. 3) Directory with ACL entries including default ACL entries:
  3475.  
  3476.  
  3477.  
  3478.  • $ file: foodir
  3479.  • $ owner: craig
  3480.  • $ group: demo
  3481.  • user::rwx
  3482.  • user:spy:---
  3483.  • user:larry:rwx
  3484.  • group::r-x
  3485.  • class:rwx
  3486.  • other:r-
  3487.  • default:user::rwx
  3488.  • default user :larry :rwx
  3489.  • default:rnser:worm:- --
  3490.  • default :group:demo:r -
  3491.  • default:other:---
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497. A.23 4
  3498.  
  3499.  
  3500.  
  3501. DESCRIPTION:  The act call will support the getting and setting
  3502. of discretionary
  3503.  
  3504.  •  permission information associated with a file. It will
  3505. allow the file owner or a process with appropriate permission
  3506. or appropriate privilege to perform the following functions:
  3507.  
  3508.  • 1. get or set a file's ACL information in an atomic operation.
  3509.  • 2. return the number of entries contained in an file's ACL.
  3510.  
  3511.  
  3512.  
  3513.  
  3514.  
  3515.  
  3516. Note that this call only supports the file system objects: e.g.,
  3517. regular files, special files, directories, and named pipes. For
  3518. simplicity, these objects are referred to as "files".
  3519. SYNOPSIS:
  3520.  
  3521.  
  3522.  
  3523. #include <tbd.h>
  3524.  
  3525.  
  3526. int acl(const char *path, int cmd. int nentries, struct acl "aclbufp)
  3527.  
  3528.  
  3529. Three values for cmd will be supported: ACLSET, ACLGET, and ACL_CNT.
  3530.  The value of nentries is the number of ACL entries that can fit
  3531. in the user-supplied ACL buffer for an ACL_GET or the number actually
  3532. present for an ACL_SET; and aclbufp is a pointer to the user-supplied
  3533. buffer of ACL entry structures.  The buffer will consist of an
  3534. array of four  (USEROBJ, GROUPOBJ, CLASSOBJ, and OTHEROBJ entries
  3535. are required) or more occurrences of the following structure:
  3536.  
  3537.  • struct acl [
  3538.  • intatype;
  3539.  • uidt aid;
  3540.  • ushort a_perm;
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548. Twelve values of arype will be supported to specify the type of
  3549. entry: (six for access checking and six for defaults), USEROBJ,
  3550. USER, GROUPOBJ, GROUP,   CLASSoBJ,   OTHERoBJ,   DEF_USER_OBJ,
  3551.   DEF&SER, DEFGROUPoBJ, DEFGROUP, DEFCLASSoBJ, and DEFoTHERoBJ.
  3552.  When arype is USER or DEF,USER, aid will be a user id, and when
  3553. atype is GROUP or DEFGROUP, aid will be a group id. When atype
  3554. is USERoBJ, GROUPoBJ,          CLASSoBJ,         OTHER_OBJ,  
  3555.      DEF_USERoBJ, DEFGROUPoB,l, DEFCLASSoBJ, or DEF_OTHER_OBJ,
  3556. aid will not be used. The permissions for the entry will be contained
  3557. in a~erm.
  3558.  
  3559.  •  56 -
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567. PROCESSING:     When the specified cmd is ACL,CNT, the return
  3568. value from the call
  3569.  
  3570.  
  3571. will be the number of ACL entries for the filename pointed to
  3572. by path. The values of nentries and ac'bitfp will be ignored.
  3573. ff the user does not pass the DAC and MAC checks to see the ACL.
  3574. the act call will fail (see ERRORS AND RETURNS).
  3575.  
  3576.  
  3577. When the specified cmd is ACL_GET. the ACL information for the
  3578. filename pointed to by path will be retrieved and the ACL entries
  3579. will be placed in the buffer pointed to by actbttjp. The value
  3580. of nentries is the number of entries that can be held in the allocated
  3581. buffer. If the number of ACL entries in the ACL is greater than
  3582. the value of ttentries (that is. the buffer space allocated to
  3583. hold the files ACL entries is less than nentries times the size
  3584. of an entry), the acl call will fail (see ERRORS AND RETURNS).
  3585. On success. the return value from this call will be the number
  3586. of ACL entries retrieved. On any error. the contents of the acl
  3587. structures pointed to by actbufp are indeterminate. If the user
  3588. does not pass the DAC and MAC checks to see the ACL, the act call
  3589. will fail (see ERRORS AND RETURNS).
  3590.  
  3591.  
  3592. When the specified cmd is ACL_SET, ACL entries currently in the
  3593. buffer pointed to by actbufp, for the filename pointed to by path,
  3594. will be set if all required checks are passed. The contents of
  3595. nentries shall be the number of ACL entries in the buffer, pointed
  3596. to by aclbufp, to be copied. On success.  the return value from
  3597. this call will be 0. If the invoking user does not pass the DAC
  3598. and MAC checks to set an ACL, the act call will fail (see ERRORS
  3599. AND RETURNS). If an error occurs, either due to DAC and MAC checks
  3600. or the validation check listed below. there will be no change
  3601. to the current ACL information. Before the ACL entries are actually
  3602. set, validation checks will be performed to determine that the
  3603. ACL entries are in the following order:
  3604.  
  3605.  • a) a user entry for the file owner (USEROBJ),
  3606.  • b) additional user entries (USER),
  3607.  • c) a group entry for the file owning group (GROUPOBJ),
  3608.  • d) additional group entries (GROUP),
  3609.  • e) a class entry for the file group class (CLASSOBJ),
  3610.  • f) an entry for other (OTHEROBJ),
  3611.  • g) default user entry for the file owner (DEFLySEROBJ),
  3612.  • h) default additional user entries (DEFLSER),
  3613.  • i) default group entry for the file owning group (DEF,GROUPOBJ),
  3614.  • j) default additional group entries (DEFGROUP),
  3615.  • k) default class entry for file group class (DEFCLASSOIBJ).
  3616.  • l) default entry for other (DEFOTHEROBJ),
  3617.  
  3618.  
  3619.  
  3620.  
  3621. The entry in classes a), c), e), and f) must always exist. The
  3622. entry for classes a), c)9 e), f), g), i), k), and l) do not use
  3623. the aid field. Classes b) and h) may contain zero or more entries
  3624. and the entries must be sorted by uid (lowest to highest). Classes
  3625. d) and j) may contain zero or more entries and the entries must
  3626. be sorted by gid (lowest to highest). (this ordering should be
  3627. done with the aclsort function).
  3628.  
  3629.  
  3630. Class g). h), i), j), k) and l) entries are only applicable for
  3631. directories. If an attempt is made to set default ACL entries
  3632. on a file that is not a directory, the call will fail (see ERRORS
  3633. AND RETURNS).
  3634.  
  3635.  
  3636. Validation of the ACL will be performed. If entries containing
  3637. duplicate uids or gids are found, or there is not exactly one
  3638. user entry specified for the file owner, one group entry specified
  3639. for the file owning group. one class entry specified for the file
  3640. group class, and one other entry specified, or there are no additional
  3641. user and group entries and the permissions of the class entry
  3642. are not equal to the permissions of the group entry, or there
  3643. are no additional default:user and default:group entries and the
  3644. permissions of the default:class entry is not equal to the permissions
  3645. of the default:group entry, the call will fail (see ERRORS AND
  3646. RETURNS).
  3647.  
  3648.  
  3649. The file owner class permission bits will be changed, such that
  3650. they are equal to the permissions specified for the user entry
  3651. of the file owner in the ACL.  The file group class permission
  3652. bits will be changed, such that they are equal to the permissions
  3653. specified for the class ACL entry. The file other class permission
  3654. bits will be changed, such that they are equal to the permissions
  3655. specified for the other ACL entry.
  3656.  
  3657.  
  3658. This function may be executed on a file system that d~s not support
  3659. ACLs.  With ACLGET as the cmd it will report the ACL& based
  3660. on the file permission bits. With ACLSET as the cmd, if ACL entries
  3661. are specified which do not map into the file permission bits,
  3662. see ERRORS AND RETURNS, otherwise the file permission bits will
  3663. be set.
  3664.  
  3665.  
  3666. A design may constrain the maximum number of ACL entries that
  3667. are
  3668.  
  3669.  
  3670. written, with a system-wide tunable parameter, aclmax.  If the
  3671. number of
  3672.  
  3673.  
  3674. ACL entries exceeds the value of aclmax the function will fail
  3675. (see ERRORS AND RETURNS).
  3676.  
  3677.  
  3678. ERRORS AhD RETURNS: If the act call is unsuccessful, a value
  3679. of -I will be
  3680.  
  3681.  
  3682. returned and errno will be set to indicate the error. Only implementation-independent
  3683. errnos are presented.
  3684.  
  3685.  
  3686. Under the following conditions, the function act will fail and
  3687. will set errno to the specified value (note: unless otherwise
  3688. stated. the errno applies to ACLCNT, ACLGET, and ACLSET):
  3689.  
  3690.  
  3691.          ENOTDIR      if a component of the path prefix is not
  3692. a directory
  3693.  
  3694.  
  3695.          ENOTDIR      if an attempt is made to set a default ACL
  3696. on a file type
  3697.  
  3698.  
  3699. other than a directory
  3700.  
  3701.  
  3702.          ENOENT       if a component of the pathname should exist
  3703. but does not
  3704.  
  3705.  
  3706.           EACCES      if the DAC and/or MAC check fails
  3707.  
  3708.  
  3709.           EINVAL      if cmd is not ACLCNT, ACLGET, or ACLSET
  3710.  
  3711.  
  3712.          EINVAL       if cmd is ACLSET and the ACL entries do
  3713. not pass the
  3714.  
  3715.  
  3716.                       validation check
  3717.  
  3718.  
  3719.          ENOSPC       if cmd is ACLGET and the space required
  3720. for the
  3721.  
  3722.  
  3723.                       file's ACL entries exceeds nentries
  3724.  
  3725.  
  3726.         ENOSPC       if cmd is ACL,SET and there is insufficient
  3727. space
  3728.  
  3729.  
  3730.                       in the file system to store the ACL
  3731.  
  3732.  
  3733.          EINVAL       if the number of acl entries exceeds the
  3734. value of aclmax
  3735.  
  3736.  
  3737.          ENOSYS       if the file system type does not support
  3738. ACLs, and
  3739.  
  3740.  
  3741.                       additional entries are specified
  3742. aclsort Function
  3743.  
  3744.  
  3745.  
  3746. DESCRIPTION:   The aclsort function will take as input a buffer
  3747. containing ACL
  3748.  
  3749.  
  3750. entries (including default ACL entries) and sort them into the
  3751. correct order to be accepted by the act or the aclipc function.
  3752. It will optionally calculate the maximum permissions needed for
  3753. the object group class and set the class ACL entry.
  3754. SYNOPSIS:
  3755.  
  3756.  
  3757.  
  3758. $include <tbd.h> int aclsort(int nentries, int calclass,
  3759. struct acl *aclbufp) Where the value of nentries is the number
  3760. of ACL entries, the value of calclass if non-zero indicates to
  3761. recalculate the class entry, and aclbufp is a pointer to ACL entry
  3762. structures.
  3763.  
  3764.  
  3765. PROCESSING:    A call to aclsort will result in the contents of
  3766. the buffer being sorted
  3767.  
  3768.  
  3769. in the following order:
  3770.  
  3771.  • a) a user entry for the object owner,
  3772.  • b) additional user entries.
  3773.  • c) a group entry for the object owning group,
  3774.  • d) additional group entries,
  3775.  • e) a class entry for the file group class,
  3776.  • f) an entry for other,
  3777.  • g) default user entry for the object owner.
  3778.  • h) default additional user entries,
  3779.  • i) default group entry for the object owning group.
  3780.  • j) default additional group entries,
  3781.  • k) default class entry for the file group class,
  3782.  • l) default entry for other.
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790. Classes a), c), e), and f) must each have exactly one entry, if
  3791. not, see ERRORS AND RETURNS. Classes g), i), k), and l) must have
  3792. zero or one entry, if not, see ERRORS AND RETURNS.  Entries will
  3793. be sorted in increasing order, by user ID in classes b) and h),
  3794. and by group ID in classes d) and j). Following  sorting, a check
  3795. will be performed to verify that no duplicate entries (more than
  3796. one entry containing the same user ID or the same group ID) exist.
  3797. If duplicate entries are found, see ERRORS AND RETURNS.  If there
  3798. are no entries in classes b) and d). the function will set the
  3799. permission field, a~er'n. in the class entry e) to that of the
  3800. group entry c). If there are entries in classes b) or d) and the
  3801. calclass argument is non-zero, the function will set the permission
  3802. field, a~erm, of the class entry to the maximum permission of
  3803. the entries in the file group class. Otherwise, the class entry
  3804. permissions will remain unchanged.
  3805.  
  3806.  
  3807. If there are no entries in classes h) and j), the function will
  3808. set the permissions in the default class entry k) to that of the
  3809. default entry i).  Upon success. aclsort will return the value
  3810. 0.
  3811.  
  3812.  
  3813. ERRORS AND RETURhS: If the aclsort function is unsuccessful due
  3814. to duplicate
  3815.  
  3816.  
  3817. entries, the return value will be the position (entry number)
  3818. of the first duplicate entry. If there is less than one user entry
  3819. for the object owner, group entry for the object owning group,
  3820. class entry for the file group class. or other entry specified,
  3821. a value of -1 will be returned. If there is more than one user
  3822. entry for the object owner. group entry for the object owning
  3823. group, class entry for the file group class. or other entry specified,
  3824. they will be treated as duplicate entries, and the return value
  3825. will be the position of the duplicate entry.
  3826.  
  3827.  
  3828. If the aclsort function is unsuccessful for any other reason,
  3829. a value of -1 will be returned.
  3830. chmod Function
  3831.  
  3832.  
  3833.  
  3834. DESCRIPTION:    The chmod function supports the following functionality:
  3835.  
  3836.  • 1. it allows a subject to change the file mode. including
  3837. the permissions for the file owner class. the file group class,
  3838. and the file other class of a file.  Note that the chmod command
  3839. will not require any modifications.
  3840.  
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.  
  3847. SYNOPSIS:   No change.
  3848.  
  3849.  
  3850. PROCESSING:    Any permissions changes made with the chmod command
  3851. or function
  3852.  
  3853.  
  3854. will update the file permission bits. This includes changing the
  3855. file owner ACL entry.  the  class ACL  entry, and the  other 
  3856. ACL entry if the corresponding group(s) of bits are changed by
  3857. this call. Any additional ACL entries will not be affected. Note.
  3858. the permissions granted by such additional entries are constrained
  3859. by the file group class permission bits. If no additional user
  3860. and no additional group entries exist, the file group class permission
  3861. bits will also represent the permissions for the owning group
  3862. of the file.
  3863.  
  3864.  
  3865. ERRORS AND RETURNS: No change.
  3866.  
  3867.  
  3868. OUTPUT:    No change.
  3869. chown Function
  3870.  
  3871.  
  3872.  
  3873. DESCRIPTION:    The choivn function supports the following functionality:
  3874.  
  3875.  • 1. it allows a subject to change the owner and/or group of
  3876. a file.
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884. Note that the chotin system call/command and the chgrp command
  3885. will not require any modifications.
  3886.  
  3887.  
  3888. SYNOPSIS:   No change.
  3889.  
  3890.  
  3891. PROCESSING:    When the owner of a file is changed, the result
  3892. will be identical to
  3893.  
  3894.  
  3895. the current behavior.  If the owner is changed to a user ID. for
  3896. which an additional user entry already exists in the ACL, the
  3897. additional user entry is not changed but the user entry for the
  3898. file owner will take precedence during an access check. When the
  3899. group of a file is changed. the result will be identical to the
  3900. current behavior. lithe group is changed to a group ID, for which
  3901. an additional group entry already exists in the ACL, the additional
  3902. group entry is not changed but the group entry for the file owning
  3903. group will take precedence during an access check (except in the
  3904. case of multiple concurrent groups, where all group entries are
  3905. given equal treatment).
  3906.  
  3907.  
  3908. ERRORS AND RETURNS: No change.
  3909.  
  3910.  
  3911. OUTPUT:    No change.
  3912.  
  3913.  
  3914. EXAMPLES:    The following examples illustrate the operation of
  3915. the cho\L'n function.
  3916.  
  3917.  
  3918. For each example, there is a "before" state showing
  3919. the output of getacl, the chown function that is executed, and
  3920. the "after" state output.
  3921.  
  3922.  • EXAMPLE 1:
  3923.  • BEFORE:
  3924.  • $ file: filel
  3925.  • $ owner: larry
  3926.  • $ group: guest
  3927.  • user::rwx
  3928.  • group::r-
  3929.  • class:r- -
  3930.  • other:---
  3931.  • CALL:  chown(filel, lisa, demo)
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  • AFTER:
  3939.  • $file:filel
  3940.  • $ owner: lisa
  3941.  • $ group: demo
  3942.  • user::rwx
  3943.  • group::r-
  3944.  • class:r-
  3945.  • other:---
  3946.  • EXAMPLE 2:
  3947.  • BEFORE:
  3948.  • $ file: file2
  3949.  • $ owner: tarry
  3950.  • $ group: guest
  3951.  • user::rwx
  3952.  • user:fred:r-
  3953.  • group::r-
  3954.  • group:dev:r-
  3955.  • class:r-
  3956.  • other:- -
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964. CALL:  chown(file2. lisa demo)
  3965.  
  3966.  • AFTER:
  3967.  • $ file: file2
  3968.  • $ owner: lisa
  3969.  • $ group: demo
  3970.  • user::rwx
  3971.  • user:fred:r- -
  3972.  • group::r-
  3973.  • group:dev:r-
  3974.  • class:r-
  3975.  • other:---
  3976.  • EXAMPLE 3:
  3977.  • BEFORE:
  3978.  • $ file: file3
  3979.  • $ owner: larry
  3980.  • $ group: guest
  3981.  • user::rwx
  3982.  • user:lisa:r-
  3983.  • user:fred:r-
  3984.  • group::r-
  3985.  • group:dev:r-
  3986.  • group:demo:r-
  3987.  • class:r-
  3988.  • other:-- -
  3989.  • CALL:  chown(file3. lisa, demo)
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  • AFTER:
  3997.  • $ file: file3
  3998.  • $ owner: lisa
  3999.  • $ group: demo
  4000.  • user::rwx
  4001.  • user:lisa:r-
  4002.  • user:fred:r-
  4003.  • group::r-
  4004.  • group:dev:r-
  4005.  • group:demo:r-
  4006.  • class:r-
  4007.  • other:---
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015. Note in EXAMPLE 3, a user entry contains a user ID that is the
  4016. same as the file owner.  In this case the file owner entry takes
  4017. precedence.  Also in EXAMPLE 3, a group entry contains a group
  4018. ID that is the same as the owning group of the file. If multiple
  4019. concurrent groups are not being used, the object owning group
  4020. entry takes precedence.
  4021. aclipc Function
  4022.  
  4023.  
  4024.  
  4025. DESCRIPTION:   The actipc call will support the getting and setting
  4026. of discretionary
  4027.  
  4028.  
  4029. `permission information associated with an IPC o6ject. It will
  4030. allow the object owner or a process with appropriate permission
  4031. or appropriate privilege to perform the following functions:
  4032.  
  4033.  • 1. get or set an IPC object's ACL information in an atomic
  4034. operation.
  4035.  • 2. return the number of entries contained in an IPC object's
  4036. ACL.
  4037.  
  4038.  
  4039.  
  4040.  
  4041. Note that this call only supports the IPC objects:  e.g., shared
  4042. memory segments. semaphores. and message queues. For simplicity,
  4043. these objects are referred to as "IPC objects" in the
  4044. remainder of this description.
  4045.  
  4046.  
  4047. SYNOPSIS:
  4048.  
  4049.  
  4050. #include <tbd.h> int aclipc(int type, int id, int cmd, int
  4051. nentries, struct acl *aclbufp) Three values for type will be supported:
  4052. IPCSHM, IPCSEM, and IPCMSG.  If type is IPC_$HM, id must be a
  4053. valid shmid returned by shmget. If type is IPC,SEM. id must be
  4054. a valid semid returned by semget. If type is IPC,MSG, id must
  4055. be a valid msgid returned by msgget. Three values for cmd will
  4056. be supported: ACLSET. ACLGET, and ACL_CNT. The value of nentries
  4057. is the number of ACL entries that can fit in the user-supplied
  4058. ACL buffer for an ACLGET or the number actually present for an
  4059. ACLSET; and aclbufp is a pointer to the user-supplied buffer of
  4060. ACL entry structures. The buffer will consist of an array of four
  4061. (USEROBJ, GROUPOBJ, CLASSOBJ, and OTHEROBJ entries are required)
  4062. or more occurrences of the following structure:
  4063.  
  4064.  • struct acl (
  4065.  • intatype;
  4066.  • uidt aid;
  4067.  • ushort aperm;
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075. Six values of ajype will be supported  to specify the type of
  4076. entry:
  4077.  
  4078.  
  4079. USERoBJ, USER, GROUPOBJ, GROUP, CLASSOBJ, and OTHEROBJ.  When
  4080. ajype is USER, aid will be a user id, and when ajype is GROUP,
  4081. aid will be a group id. When ajype is USEROBJ, GROUPOBJ, CLASSOBJ,
  4082. or OTHEROBJ, aid will not be used. The permissions for the entry
  4083. will be contained in ajerm.
  4084.  
  4085.  
  4086. PROCESSING:    When the specified cmd is ACLCNT, the return value
  4087. from the call
  4088.  
  4089.  
  4090. will be the number of ACL entries for the IPC object specified
  4091. by type and id.  The values of net!tries and aclbufp will be ignored.
  4092. If the invoking user does not pass the DAC or MAC checks to see
  4093. the ACL. the aclipc call will fail (see ERRORS AND RETURNS).
  4094.  
  4095.  
  4096. When the specified cmd is ACLGET the ACL information for the IPC
  4097. object specified by type and id will be retrieved and the ACL
  4098. entries will be placed in the buffer pointed to by aclbufp. The
  4099. value of i;entries is the number of entries that can be held in
  4100. the buffer. If the number of ACL entries in the ACL is greater
  4101. than the value of nentries (the buffer space allocated to hold
  4102. the file's ACL entries is less than nentries times the size of
  4103. an entry), the aclipc call will fail (see ERRORS AND RETURNS).
  4104. On success. the return value from this call will be the number
  4105. of ACL entries retrieved. On any error, the contents of the acl
  4106. structures pointed to by aclbiifp are indeterminate. If the user
  4107. does not pass the DAC and MAC checks to see the ACL, the aclipc
  4108. call will fail (see ERRORS AND RETURNS).
  4109.  
  4110.  
  4111. When the specified cmd is ACLSET, ACL entries currently in the
  4112. buffer, pointed to by aclbufp, for the IPC object specified by
  4113. type and id, will be set if all required checks are passed. The
  4114. contents of nentries shall be the number of ACL entries in the
  4115. buffer pointed to by aclbufp to be copied. On success, the return
  4116. value from this call will be 0. If the invoking subject does not
  4117. pass the DAC and MAC checks to set an ACL  the aclipc call will
  4118. fail (see ERRORS AND RETURNS).  If an error occurs, either due
  4119. to DAC or MAC checks or the validation check listed below, there
  4120. will be no change to the current ACL information. Before the ACL
  4121. entries are actually set, validation checks will be performed
  4122. to determine that the ACL entries are in the following order:
  4123.  
  4124.  • a) a user entry for the IPC object owner (USEROBJ),
  4125.  • b) additional user entries (USER),
  4126.  • c) a group entry for the IPC object owning group (GR,OUPOBJ),
  4127.  • d) additional group entries (GROUP),
  4128.  • e) a class entry for the IPC group class (CLASSOBJ),
  4129.  • f) an entry for other (OTHEROBJ).
  4130.  
  4131.  
  4132.  
  4133.  
  4134.  
  4135.  
  4136.  • The entries in class a), c), e), and f) must always exist.
  4137. The entry for class a),
  4138.  
  4139.  
  4140.  
  4141.  
  4142. c), e), and f) do not use the aid field. Class b) may contain
  4143. zero or more entries and the entries must be sorted by uld (lowest
  4144. to highest). Class d) may contain zero or more entries and the
  4145. entries must be sorted by gid (lowest to - highest). (this ordering
  4146. should be done with the aclsort function).  Validation of the
  4147. ACL will be performed. If entries containing duplicate ttids or
  4148. gids are found. or there is not exactly; one user entry for the
  4149. object owner.  one group entry for the object owning group. one
  4150. class entry for the IPC group class, or one other entry specified.
  4151. or there are no additional user and group entries and the permissions
  4152. of the class entry are not equal to the permissions of the group
  4153. entry, the call will fail (see ERRORS AND RETL'RNS).  The IPC
  4154. owner permission bits will be changed, such that they are equal
  4155. to the permissions specified for the user entry of the object
  4156. owner in the ACL.  The IPC group class permission bits will be
  4157. changed, such that they are equal to the permissions specified
  4158. for the class ACL entry. The IPC other class permission bits will
  4159. be changed, such that they are equal to the permissions specified
  4160. for the other ACL entry.
  4161.  
  4162.  
  4163. A design may constrain the maximum number of ACL entries that
  4164. are written, with a system-wide tunable parameter, aclmax.  If
  4165. the number of ACL entries exceeds the value of aclmax the function
  4166. will fail (see ERRORS AND RETURNS).
  4167.  
  4168.  
  4169. ERRORS AND RETURNS: If the aclipc call is unsuccessful, a value
  4170. of -I will be
  4171.  
  4172.  
  4173. returned and errno will be set to indicate the error. Only implementation-independent
  4174. errnos are presented.
  4175.  
  4176.  
  4177. Under the following conditions, the function aclipc will fail
  4178. and will set errno to the specified value (note: if cmd is unspecified,
  4179. the errno applies to ACLCNT, ACLGET, and ACLSET):
  4180.  
  4181.  
  4182.     EINVAL       if type is not IPC,SHM, IPC,SEM, or IPC,MSG
  4183.  
  4184.  
  4185.     EINVAL      if the value of id is (1) not a valid messagequeueldentifier
  4186. and
  4187.  
  4188.  
  4189. the type was IPCMSG, (2) not a valid semapho~e1dentifier and
  4190.  
  4191.  
  4192. the type was IPCSEM, or (3) not a valid sharedmemory,dentifier
  4193.  
  4194.  
  4195. and the type was IPCSHM
  4196.  
  4197.  
  4198. EINVAL      if cmd is not ACLCNT, ACL_GET, or ACLSET
  4199.  
  4200.  
  4201. EINVAL       if cmd is ACLSET and the ACL entries do not pass
  4202.  
  4203.  
  4204.              the validation check
  4205.  
  4206.  
  4207. EACCES       if the DAC and/or MAC check fails
  4208.  
  4209.  
  4210. ENOSPC       if cmd is ACLGET and the space required for the
  4211.  
  4212.  
  4213.              IPC's object ACL entries exceeds nentries
  4214.  
  4215.  
  4216. ENOMEM       if cmd is ACL_SET and there is insufficient
  4217.  
  4218.  
  4219. space to store the ACL
  4220.  
  4221.  
  4222. EINVAL       if the number of acl entries exceeds the value of
  4223. aclmax
  4224. shmctl, semctl, & msgctl Functions
  4225.  
  4226.  
  4227.  
  4228. DESCRIPTION:  The shmctl. semctl, and msgctl functions support
  4229. the following
  4230.  
  4231.  
  4232. functionality:
  4233.  
  4234.  • 1. they allow a subject to change the user ID. group ID, and
  4235. permissions on IPC objects.
  4236.  
  4237.  
  4238.  
  4239.  
  4240. SYNOPSIS:  No change.
  4241.  
  4242.  
  4243. PROCESSING:    No change.
  4244.  
  4245.  
  4246. ERRORS AND RETURNS: No change.
  4247. REFERENCES
  4248.  
  4249.  
  4250.  
  4251. [1] Department of Defense  Trusted Computer Systems Evaluation
  4252. Criteria.  DoD 5200.28-STD, December 1985.
  4253.  
  4254.  
  4255. [2] National Computer Security Center, A Guide to Understanding
  4256. Discretioiiary Access Control in Trusted Systems, NCSC-TG-003
  4257. Version-I, September 1987.  [3] UNIX System Access Control List
  4258. Proposal, C. Rubin, AT&T. May 15. 1988.  [4] Adding Access
  4259. Control Lists To UNIX, A. Silverstein, B. McMahon. G. Nuss, Hewlett-Packard
  4260. Co.. March 12. 1988.
  4261.  
  4262.  
  4263. [5] Discretionary Access Control System Functions, D. H. Steves,
  4264. IBM, March 14, 1988.
  4265.  
  4266.  
  4267. [6] P1003 .6 Security Extension Proposal: Discretionary Access
  4268. Control Semantics, W. Olin Sibert. Oxford Systems Inc., May 18.
  4269. 1988.
  4270.  
  4271.  
  4272. [7] PlOO3.6 Supplementary Document: Discretionary Access Control..
  4273.  Problems in P1003.1 Draft 12 , W. Olin Sibert, Oxford Systems
  4274. Inc.. May 18, 1988.  [8] P1003.6 Supplementary Document: Comments
  4275. on Hewlett-Packard ACL Proposal, W. Olin Sibert. Oxford Systems
  4276. Inc., May 18,1988.
  4277.  
  4278.  
  4279. [9] Extending The UNIX Protection Model with Access Control Lists,
  4280. G. Fernandez, L. Allen, Apollo Computer Inc., June 1988.
  4281.  
  4282.  
  4283. [10] On Incorporating Access Control Lists into the UNIX Operating
  4284. System S. M. Kramer, SecureWare Inc., June 1988.
  4285.  
  4286.  
  4287. [11] Trusted UNIX Discretionary Ac~ss and Privilege Control Mechanisms,
  4288. B.D.
  4289.  
  4290.  
  4291. Wilner, Infosystems Technology Inc.. June 2,1988.
  4292.  
  4293.  
  4294. (12] Access Control List Design, Hewlett Packard, October 21,
  4295. 1988.
  4296.  
  4297.  
  4298. [13] Proposal for Adding Access Control Lists to POSIX, P. B.
  4299. Flinn, SecureWare Inc., July 25, 1988.
  4300.  
  4301.  
  4302. [14] Discretionary  Access  Control  Proposal,  H.  L.  Hall,
  4303.  Digital  Equipment Corporation, Oct. 1988.
  4304.  
  4305.  
  4306. [15] Portable Operating System Interface for Computer Environments
  4307. IEEE Std. 1003.1-1988
  4308.  
  4309.  
  4310.  
  4311. l